Host Your Own MTProto Proxy
Complete guide to setting up your personal MTProto proxy server on Ubuntu using Docker
Need Help? Contact SupportWhat is MTProto Proxy?
MTProto is Telegram's proprietary protocol designed for secure, fast communication. An MTProto proxy acts as an intermediary server that helps users access Telegram when it's blocked or restricted in their region.
By hosting your own proxy server, you get:
- Complete control over your connection
- Better privacy and security
- Reliable access to Telegram
- Ability to share with friends and family
- No dependency on third-party services
Prerequisites
Server Requirements
- Ubuntu 20.04 or newer
- Minimum 1GB RAM
- 10GB+ storage space
- Public IP address
- Root or sudo access
Network Requirements
- Port 443 available
- Stable internet connection
- No firewall blocking Docker
- Domain name (optional)
Generate Your Secret
First, generate a random 32-character hexadecimal secret for your MTProto proxy:
Installation Steps
Update Your System
Connect to your Ubuntu server via SSH and update the system packages:
sudo apt update && sudo apt upgrade -y
Install Docker
Install Docker using the official installation script:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER
Note: You may need to log out and back in for the group changes to take effect.
Install Docker Compose
Install Docker Compose for easier container management:
sudo apt install docker-compose-plugin -y
Create Project Directory
Create a directory for your MTProto proxy configuration:
mkdir ~/mtproto-proxy
cd ~/mtproto-proxy
Create Docker Compose File
Create a docker-compose.yml
file with your configuration:
services: mtproto-proxy: image: telegrammessenger/proxy:latest container_name: mtproto-proxy ports: - "443:443" environment: - SECRET=<YOUR_SECRET_HERE> restart: always
Replace <YOUR_SECRET_HERE>
with the secret you generated above.
Configure Firewall
Open port 443 for the MTProto proxy:
sudo ufw allow 443/tcp
sudo ufw enable
Start the Proxy
Launch your MTProto proxy using Docker Compose:
docker compose up -d
The -d
flag runs the container in the background.
Verify Installation & Get Your Proxy URL
Check if your proxy is running correctly and get your connection URL:
docker compose ps
docker compose logs mtproto-proxy
You should see the container running and logs indicating successful startup.
📋 Getting Your Proxy URL
Look for a line in the logs that contains your proxy URL. It will look something like:
tg://proxy?server=YOUR_SERVER_IP&port=443&secret=YOUR_SECRET
Copy this URL - you'll need it to connect to your proxy or share it with others.
Connect to Your Proxy
Connection Details
- Server: Your server's IP address
- Port: 443
- Secret: Your generated secret
- Protocol: MTProto
Telegram Setup
- 1. Open Telegram Settings
- 2. Go to Data and Storage
- 3. Select Proxy Settings
- 4. Add Proxy → MTProto
- 5. Enter your server details
🚀 Share Your Proxy with Friends
Want to quickly share your proxy with friends and family? Use our secure share feature!
Share Your Proxy100% Safe
No data is collected or stored. Everything happens in your browser.
Quick & Easy
Just paste your proxy URL and get a shareable link instantly.
User Friendly
Recipients get a clean page with one-click connection to your proxy.
Troubleshooting
Container Won't Start
- Check if port 443 is already in use:
sudo netstat -tlnp | grep :443
- Verify Docker is running:
sudo systemctl status docker
- Check container logs:
docker compose logs
Can't Connect from Telegram
- Verify firewall settings allow port 443
- Check if your cloud provider's security groups allow the port
- Ensure the secret is exactly 32 hexadecimal characters
- Try restarting the container:
docker compose restart
Performance Issues
- Monitor resource usage:
docker stats
- Check server bandwidth and latency
- Consider upgrading server specifications
- Ensure server location is geographically close to users
Management Commands
Basic Operations
docker compose up -d
Start the proxy
docker compose down
Stop the proxy
docker compose restart
Restart the proxy
Monitoring
docker compose logs -f
View live logs
docker compose ps
Check status
docker stats mtproto-proxy
Resource usage
🔒 Security Considerations
- Keep your server updated with security patches
- Use strong passwords and SSH keys for server access
- Consider setting up a firewall with only necessary ports open
- Monitor server logs for unusual activity
- Don't share your proxy details publicly
- Regularly backup your configuration
Need Additional Help?
If you encounter any issues or need assistance with the setup, don't hesitate to reach out for support.
Get Help & Contact Info