A simple, reliable, and automated script for installing the Telegram MTProxy server using Docker. This script solves all the complexities of configuring the Telegram proxy server.
- Overview
- Features
- Requirements
- Quick Start
- Installation Guide
- Usage
- Management Commands
- Troubleshooting
- Uninstallation
- Contributing
- License
MTProxy is the official Telegram proxy server that allows users to bypass network restrictions while maintaining secure connections. This script automates the entire installation process using Docker, making it accessible even for users with minimal technical knowledge.
- Checks system requirements - Verifies root access and system compatibility
- Installs Docker - Automatically installs Docker if not present
- Cleans up old installations - Removes any existing MTProxy installations
- Configures the proxy - Sets up MTProxy with your chosen port
- Manages firewall rules - Opens necessary ports in UFW/firewalld
- Generates connection details - Creates ready-to-use proxy links
- Creates management tools - Installs the
mtproxy
command for easy management - Sets up auto-updates - Configures weekly automatic updates via cron
- 🚀 One-line installation - No complex configuration needed
- 🐳 Docker-based - Isolated, secure, and easy to manage
- 🔐 Automatic secret generation - Secure proxy credentials created automatically
- 🔧 Custom port selection - Choose any available port
- 🛡️ Firewall auto-configuration - Works with UFW and firewalld
- 📊 Built-in management commands - Easy control after installation
- 🔄 Auto-updates - Keeps your proxy server up-to-date
- 📱 QR code generation - Quick mobile setup (if qrencode installed)
- 💾 Persistent configuration - Settings saved across restarts
- Operating System: Ubuntu, Debian, CentOS, or any Linux distribution with systemd
- Architecture: x86_64 (amd64)
- Access: Root or sudo privileges
- Network:
- Public IP address
- Open port (you choose during installation, default: 8443)
- Stable internet connection
- RAM: Minimum 512MB
- Disk Space: Minimum 1GB free space
# Download and run the installation script
wget https://raw.githubusercontent.com/statix05/MTProxyInstall/main/install.sh
chmod +x install.sh
sudo ./install.sh
That's it! Follow the prompts and your proxy will be ready in minutes.
# Using wget
wget https://raw.githubusercontent.com/statix05/MTProxyInstall/main/install.sh
# Or using curl
curl -O https://raw.githubusercontent.com/statix05/MTProxyInstall/main/install.sh
chmod +x install.sh
sudo ./install.sh
- The script will ask for a port number (press Enter for default 8443)
- Wait for the installation to complete
- Copy the generated proxy links
Use one of the generated links to add the proxy to your Telegram:
- Direct link:
tg://proxy?server=YOUR_IP&port=YOUR_PORT&secret=YOUR_SECRET
- Web link:
https://t.me/proxy?server=YOUR_IP&port=YOUR_PORT&secret=YOUR_SECRET
$ sudo ./install.sh
=== MTProxy Docker Installation ===
Cleaning up old installations...
Enter proxy port (default 8443): 9443
Starting MTProxy...
✓ MTProxy started successfully!
Connection details:
IP: 123.45.67.89
Port: 9443
Secret: abc123def456...
Connection links:
tg://proxy?server=123.45.67.89&port=9443&secret=abc123def456...
The script creates a mtproxy
command for easy management:
# Check proxy status
mtproxy status
# View real-time logs
mtproxy logs
# Show connection information
mtproxy info
Command | Description |
---|---|
mtproxy status |
Check if proxy is running and show port |
mtproxy logs |
View real-time proxy logs (Ctrl+C to exit) |
mtproxy info |
Display connection links and proxy details |
mtproxy restart |
Restart the proxy server |
mtproxy stop |
Stop the proxy server |
mtproxy start |
Start the proxy server |
mtproxy update |
Update to the latest MTProxy version |
# Check if proxy is running
$ mtproxy status
CONTAINER ID IMAGE STATUS PORTS
abc123def456 telegrammessenger/proxy Up 2 hours 0.0.0.0:9443->443/tcp
Proxy port: 9443
# View logs
$ mtproxy logs
[*] Starting proxy...
[*] Secret: abc123def456...
[*] Listening on port 443
# Get connection info
$ mtproxy info
MTProxy Information:
===================
IP: 123.45.67.89
Port: 9443
Secret: abc123def456...
Connection links:
tg://proxy?server=123.45.67.89&port=9443&secret=abc123def456...
1. Permission Denied
# Make sure to run with sudo
sudo ./install.sh
2. Port Already in Use
# Check what's using the port
sudo lsof -i :8443
# Choose a different port during installation
3. Cannot Connect to Proxy
# Check if container is running
docker ps | grep mtproxy
# Check firewall
sudo ufw status
# View logs for errors
mtproxy logs
4. Docker Installation Failed
# Install Docker manually
curl -fsSL https://get.docker.com | sudo sh
- Check logs:
mtproxy logs
- Verify status:
mtproxy status
- Connection info saved in:
/etc/mtproxy/info.txt
To completely remove MTProxy and all its data:
# Download cleanup script
wget https://raw.githubusercontent.com/statix05/MTProxyInstall/main/cleanup.sh
chmod +x cleanup.sh
sudo ./cleanup.sh
This will:
- Stop and remove Docker containers
- Delete all proxy data
- Remove systemd services
- Clean up configuration files
- Close firewall ports
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Telegram MTProxy - Official Telegram proxy server
- Docker - Container platform
- Community contributors
⭐ If this script helped you, please consider giving it a star on GitHub!