Host Your Own MTProto Proxy

Complete guide to setting up your personal MTProto proxy server on Ubuntu using Docker

Need Help? Contact Support

What 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

1

Update Your System

Connect to your Ubuntu server via SSH and update the system packages:

sudo apt update && sudo apt upgrade -y
2

Install Docker

Install Docker using the official installation script:

curl -fsSL https://get.docker.com -o get-docker.shsudo sh get-docker.shsudo usermod -aG docker $USER

Note: You may need to log out and back in for the group changes to take effect.

3

Install Docker Compose

Install Docker Compose for easier container management:

sudo apt install docker-compose-plugin -y
4

Create Project Directory

Create a directory for your MTProto proxy configuration:

mkdir ~/mtproto-proxycd ~/mtproto-proxy
5

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.

6

Configure Firewall

Open port 443 for the MTProto proxy:

sudo ufw allow 443/tcpsudo ufw enable
7

Start the Proxy

Launch your MTProto proxy using Docker Compose:

docker compose up -d

The -d flag runs the container in the background.

8

Verify Installation & Get Your Proxy URL

Check if your proxy is running correctly and get your connection URL:

docker compose psdocker 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. 1. Open Telegram Settings
  2. 2. Go to Data and Storage
  3. 3. Select Proxy Settings
  4. 4. Add Proxy → MTProto
  5. 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 Proxy

100% 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