Skip to content

MTProto Proxy on a VPS

Proxy for Telegram

Category
VPN / Proxy
Author
9seconds
License
MIT
Version
2.2.8

The script is free · VPS from $2.79 per month · installs in about 45 seconds

Install over SSH

root@vps:~# command -v docker >/dev/null || curl -fsSL https://get.docker.com | sh; S=$(docker run --rm nineseconds/mtg:2 generate-secret --hex google.com) && printf 'secret = "%s"\nbind-to = "0.0.0.0:3128"\n' "$S" > /etc/mtg.toml && docker run -d -v /etc/mtg.toml:/config.toml -p 443:3128 --name mtg-proxy --restart=unless-stopped nineseconds/mtg:2

  • SystemUbuntu 24.04 · x86_64ok
  • Sourcegithub.com/9seconds/mtgok
  • Version2.2.8ok
  • Port443/tcplisten

✓ MTProto Proxy 2.2.8 installed · about 45 seconds

root@vps:~#

Install command from the library. Output is shortened and may differ on your server.

What it is

  • Telegram
  • MTProto
  • FakeTLS
  • Proxy

MTProto Proxy is a proxy server for Telegram. A user opens a tg://proxy link and Telegram connects through your server.

It uses mtg, a lightweight Go proxy designed for 10–20 thousand concurrent connections. It supports FakeTLS mode with a domain of your choice.

mtg has no user accounting: one link for everyone. mtg v2 does not support the sponsored tag for promoting a channel.

  • tg:// and t.me/proxy connection links with a QR code
  • FakeTLS mode
  • Replay attack protection (anti-replay)
  • Thousands of concurrent connections on a minimal server
  • Runs with a single Docker command

Recommended plan

For MTProto Proxy: at least 1 vCPU, 2 GB RAM and 10 GB NVMe.

Minimum to run
1 vCPU · 1 GB RAM · 10 GB disk
Systems
Ubuntu 22.04 · Ubuntu 24.04 · Debian 12

How to install

Three steps in the bot or one command over SSH; installation takes about 45 seconds.

  1. 01

    Choose a plan in the bot

    Open @ExpressHost_bot and pay for a VPS. The server will be ready in about 60 seconds.

  2. 02

    Add MTProto Proxy

    At the “Add-ons” step pick the script from the library, or run it later: Server settings → Scripts.

  3. 03

    Get the connection links

    docker exec mtg-proxy /mtg access /config.toml

Manually over SSH

Connect to the server as root and run the command. Supported systems: Ubuntu 22.04, Ubuntu 24.04, Debian 12.

Install command
command -v docker >/dev/null || curl -fsSL https://get.docker.com | sh; S=$(docker run --rm nineseconds/mtg:2 generate-secret --hex google.com) && printf 'secret = "%s"\nbind-to = "0.0.0.0:3128"\n' "$S" > /etc/mtg.toml && docker run -d -v /etc/mtg.toml:/config.toml -p 443:3128 --name mtg-proxy --restart=unless-stopped nineseconds/mtg:2

Ports

MTProto Proxy ports
PortProtocolPurpose
443tcpTelegram client connections

After installation

  1. 1.Get the connection links: docker exec mtg-proxy /mtg access /config.toml
  2. 2.Send users the tme_url link or the QR code from the output
  3. 3.Port 443 must be free: if the server hosts a website, change -p 443:3128 to another port

MTProto Proxy FAQ

Didn’t find an answer? Message @ExpressHost_SupportBot.

How many users can the plan handle?

The mtg author designs it for 10–20 thousand concurrent connections. In practice the limit is the server's bandwidth.

How do I change the FakeTLS domain?

Generate a new secret with the desired domain, write it to /etc/mtg.toml and run docker restart mtg-proxy. Old links will stop working.

Where is the config?

In /etc/mtg.toml: the secret and the address the proxy listens on.

MTProto Proxy installs at checkout.