Skip to content

Your own Telegram proxy (MTProxy) on a VPS

MTProxy is a proxy server for Telegram: the app connects through your VPS from a tg://proxy link, and FakeTLS mode makes the connection look like TLS to an ordinary website. Three ways to run your own: one command, step by step in Docker, or the official MTProxy.

Updated

What MTProxy is

MTProxy (MTProto Proxy) is a proxy that speaks Telegram’s own MTProto protocol. Only Telegram goes through it: you open a tg://proxy or t.me/proxy link in the app, and it reaches the Telegram servers through your VPS. The rest of the device traffic goes as usual.

The secret in the link is the client password. In FakeTLS mode it starts with “ee” and ends with the domain of a cover website: the connection looks like TLS to that site. If something other than a Telegram client reaches the server, mtg passes the request to the real website, and the visitor sees its response. mtg v2 runs in FakeTLS mode only.

SOCKS5, VPN and MTProxy
AspectSOCKS5VPNMTProxy
What goes through the serverApps that support SOCKS5, Telegram includedAll device trafficTelegram only
How to connectA tg://socks link or the app settingsA separate app and a configA tg://proxy or t.me/proxy link right in Telegram
DisguiseNone: the handshake is in the clearDepends on the protocolFakeTLS: looks like TLS to a website
AccessNo password, or a username and passwordA key or config per deviceOne secret for everyone (mtg)

For all device traffic you need a VPN, such as AmneziaWG or the 3x-ui panel. For Telegram alone MTProxy is simpler: nothing to install on the phone.

What VPS you need

mtg needs very little: its author designs it for 10–20 thousand simultaneous connections. The requirements come from the MTProto Proxy card in our library.

System
Ubuntu 22.04 / 24.04 or Debian 12; all three are in our OS catalog
Resources
1 vCPU, 1 GB RAM and 10 GB of disk
Network
A public IPv4 on every VPS, a free IPv6 /64, traffic unlimited by volume
Port
A free TCP port for clients, usually 443
Platform
KVM virtualization; all our VPS run on KVM

Plans that fit

The cheapest plans for the MTProto Proxy minimum from our library (1 vCPU, 1 GB RAM, 10 GB) in the locations that have servers right now.

  • 1 vCPU, 2 GB RAM, 10 GB

    NL-R9-1

    Netherlands, Amsterdam

    $3.32/mo

    $0.12 for 24 hours · $0.83 for 7 days

    CPU
    1 × vCPU Ryzen 9950x
    Memory
    2 GB DDR5
    Disk
    10 GB NVMe
    Port
    10 Gbps
    Order this plan

    MTProto Proxy is installed manually: the install command is further down this page.

  • 1 vCPU, 2 GB RAM, 10 GB

    DE-R9-1

    Germany, Frankfurt

    $3.14/mo

    $0.11 for 24 hours · $0.79 for 7 days

    CPU
    1 × vCPU Ryzen 9950x
    Memory
    2 GB DDR5
    Disk
    10 GB NVMe
    Port
    25 Gbps
    Order this plan

    MTProto Proxy is installed manually: the install command is further down this page.

  • 1 vCPU, 2 GB RAM, 10 GB

    PL-R9-1

    Poland, Warsaw

    Lowest price

    $2.79/mo

    $0.10 for 24 hours · $0.70 for 7 days

    CPU
    1 × vCPU Ryzen 9950x
    Memory
    2 GB DDR5
    Disk
    10 GB NVMe
    Port
    5 Gbps
    Order this plan

    MTProto Proxy is installed manually: the install command is further down this page.

  • 1 vCPU, 2 GB RAM, 10 GB

    EE-R9-1

    Estonia, Tallinn

    $4.34/mo

    $0.16 for 24 hours · $1.09 for 7 days

    CPU
    1 × vCPU Ryzen 9950x3d
    Memory
    2 GB DDR5
    Disk
    10 GB NVMe
    Port
    10 Gbps
    Order this plan

    MTProto Proxy is installed manually: the install command is further down this page.

The port in Germany is 25 Gbps, in Poland 5 Gbps; the minimum plan there costs $0.35 more a month. Traffic is unlimited by volume everywhere.

MTProxy with one command

Our bot has no MTProxy script: you order the server in the bot and install the proxy with one command over SSH. It is the command of the MTProto Proxy card in our library: it installs Docker if it is missing, creates a FakeTLS secret for google.com, writes the config /etc/mtg.toml and starts the nineseconds/mtg:2 container on port 443 with automatic restart.

  1. 01

    Order a VPS

    The button on this page opens the bot with the cheapest matching plan. Choose Ubuntu 22.04, 24.04 or Debian 12 and pay for the server; the IP address and root password arrive in the chat.

  2. 02

    Connect over SSH

    Code
    ssh root@SERVER_IP
  3. 03

    Run the command

    Port 443 must be free. If the server already hosts a website, read the port 443 section below first.

    Code
    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
  4. 04

    Get the link

    The command prints JSON with the tg_url and tme_url links and their QR codes. The -p 443 flag is required: inside the container mtg listens on port 3128 and puts that port into the link without the flag.

    Code
    docker exec mtg-proxy /mtg access -p 443 /config.toml
  5. 05

    Change the FakeTLS domain

    google.com is the example from the mtg documentation. The author advises a domain related to your server’s IP: how to choose and change it is in the domain section below.

Step by step: Docker and mtg v2

mtg is a lightweight Go proxy with no user management: one secret for everyone. Only two settings are required, secret and bind-to; the rest have sensible defaults, listed in full in example.config.toml in the repository. Run the commands as root.

  1. 01

    Install Docker

    The get.docker.com script installs Docker Engine with one command. Docker itself calls it a quick-install option and recommends the apt repository for production.

    Code
    curl -fsSL https://get.docker.com | sh
  2. 02

    Create a secret

    The secret is the client password; keep it private. In hex it starts with ee, followed by the key and the FakeTLS domain. Replace DOMAIN with a domain; how to choose one is below.

    Code
    docker run --rm nineseconds/mtg:2 generate-secret --hex DOMAIN
  3. 03

    Write the config

    Save it as /etc/mtg.toml. Inside the container mtg listens on port 3128, and Docker publishes it outside. bind-to takes an IP address only: mtg rejects host names and *.

    Code
    secret = "SECRET"
    bind-to = "0.0.0.0:3128"
  4. 04

    Start the container

    443 is the port clients connect to, 3128 is the port from bind-to. The 2 tag is the current major version: the author advises against latest and stable.

    Code
    docker run -d -v /etc/mtg.toml:/config.toml -p 443:3128 --name mtg-proxy --restart=unless-stopped nineseconds/mtg:2
  5. 05

    Check the setup

    mtg doctor checks clock drift, connectivity to the Telegram data centres, the cover website and whether the domain’s DNS matches the server IP (SNI-DNS). With someone else’s domain the last check fails, as expected.

    Code
    docker exec mtg-proxy /mtg doctor /config.toml
  6. 06

    Get the links

    -p is the port published outside: without it mtg puts 3128 from bind-to into the link. mtg learns the public IP from ifconfig.co; if the address is wrong, add it to the config as public-ipv4.

    Code
    docker exec mtg-proxy /mtg access -p 443 /config.toml

Official MTProxy and the ad tag

mtg v2 has no ad tag: the author removed it on purpose. The promoted-channel tag comes from the @MTProxybot bot, and the official MTProxy by Telegram supports it. It is built from source: according to the README, the official Docker image is outdated.

  1. 01

    Build the proxy

    The binary lands in objs/bin/mtproto-proxy. If the build fails, run make clean before trying again.

    Code
    apt install git curl build-essential libssl-dev zlib1g-dev
    git clone https://github.com/TelegramMessenger/MTProxy
    cd MTProxy
    make && cd objs/bin
  2. 02

    Download Telegram’s key and config

    The Telegram server config changes now and then; the README advises updating it once a day. The third command creates the secret for clients.

    Code
    curl -s https://core.telegram.org/getProxySecret -o proxy-secret
    curl -s https://core.telegram.org/getProxyConfig -o proxy-multi.conf
    head -c 16 /dev/urandom | xxd -ps
  3. 03

    Start the proxy

    -H 443 is the client port, -p 8888 the local statistics port (wget localhost:8888/stats, from the server itself only), -M 1 the number of workers. For permanent operation the README gives an example systemd unit.

    Code
    ./mtproto-proxy -u nobody -p 8888 -H 443 -S USER_SECRET --aes-pwd proxy-secret proxy-multi.conf -M 1
  4. 04

    Register the proxy with @MTProxybot

    The bot issues a tag; add it to the start command as -P PROXY_TAG. The client link is tg://proxy?server=SERVER_IP&port=443&secret=USER_SECRET, and the bot can generate it too. With the dd prefix on the secret, the client turns on random packet padding.

How to connect and share the proxy

The link from mtg access opens in any Telegram app. It is the same for everyone: mtg has no user management, so the only way to revoke access is a new secret.

  1. 01

    Open the link

    tg://proxy?… opens straight in the app, https://t.me/proxy?… goes through the browser and is handy to forward in chats. Telegram offers to add the proxy.

  2. 02

    Or scan the QR code

    The output has tg_qrcode and tme_qrcode, links to a QR code image. The third-party service api.qrserver.com draws it, and the secret goes to it in the URL. If that matters, make the QR code from the link yourself.

  3. 03

    Or add it by hand

    In Telegram’s proxy settings choose MTProto and enter the server (IP or domain), the port and the secret: the same three parameters as in the link.

  4. 04

    Share it with a small circle

    The mtg author advises sharing the proxy with family and friends and never announcing it publicly: public proxies are the first to get blocked by IP. If the link went to the wrong place, change the secret and the old link stops working.

  5. 05

    Need separate links

    The official MTProxy takes several secrets (-S more than once). For mtg with several secrets, the author points to the mtg-multi fork.

FakeTLS domain: which to pick and how to change it

The domain is built into the secret: the client disguises the TLS handshake as one with that site, and mtg passes stray requests to it. google.com in the docs is only an example: according to the mtg author, providers easily see that the server IP does not belong to Google.

  1. 01

    Choose a domain

    The mtg README advises a domain related to the server IP. The most robust option, per the author’s recommendations, is your own domain: its A record points at the VPS, a website with a Let’s Encrypt certificate runs there, and mtg sits in front of the web server. Then DNS and SNI match, which is what mtg doctor checks. The [domain-fronting] section (host and port) sets the address of the site behind mtg.

  2. 02

    Create a new secret

    Code
    docker run --rm nineseconds/mtg:2 generate-secret --hex DOMAIN
  3. 03

    Replace the secret and restart

    Put the new secret into /etc/mtg.toml. Old links stop working, so send out new ones from mtg access.

    Code
    docker restart mtg-proxy
    docker exec mtg-proxy /mtg access -p 443 /config.toml

Port 443 and a website on the same server

One port, one program. If nginx or another web server already listens on 443, Docker cannot publish the proxy there: give the proxy another port or put mtg in front of the website.

  1. 01

    See what holds the port

    The command shows the process listening on TCP port 443.

    Code
    ss -tlnp | grep ':443 '
  2. 02

    Publish the proxy on another port

    For example 8443: -p 8443:3128 when starting the container and -p 8443 in mtg access, so that this port goes into the link.

    Code
    docker rm -f mtg-proxy
    docker run -d -v /etc/mtg.toml:/config.toml -p 8443:3128 --name mtg-proxy --restart=unless-stopped nineseconds/mtg:2
    docker exec mtg-proxy /mtg access -p 8443 /config.toml
  3. 03

    Or put mtg in front of the website

    mtg takes 443 and the website moves to another port; set its address and port in [domain-fronting], and mtg hands stray requests to the site. This is the own-domain setup from the section above.

Updating mtg

The config stays on the server in /etc/mtg.toml, so the container can be recreated without losing the secret: the links stay the same.

  1. 01

    Pull the image and recreate the container

    Code
    docker pull nineseconds/mtg:2
    docker rm -f mtg-proxy
    docker run -d -v /etc/mtg.toml:/config.toml -p 443:3128 --name mtg-proxy --restart=unless-stopped nineseconds/mtg:2
  2. 02

    Before moving to 2.3.0

    Since 2.3.0 (3 November 2026) the domain-fronting-ip and [domain-fronting].ip options are ignored; replace them with [domain-fronting].host. The secret stays. At startup mtg now checks DNS/SNI and the public IP itself: the warnings do not stop it.

Common MTProxy errors

  • Docker says port 443 is taken

    A web server or another proxy already listens on 443. Find it with ss -tlnp | grep ':443 ' and publish mtg on another port or put mtg in front of the website.

  • The link from mtg access does not connect

    Check the port in the link: without -p mtg uses 3128 from bind-to, while Docker publishes another one. Run mtg access with the published port, for example -p 443.

  • The link has the wrong IP

    mtg learns the public IP from ifconfig.co. If the service is unreachable or returns the wrong address, add public-ipv4 to /etc/mtg.toml or pass the address to mtg access with -i.

  • The proxy does not answer though the container runs

    Run mtg doctor: it shows clock drift beyond tolerate-time-skewness, unreachable Telegram data centres and the cover website. Check the external firewall too: the proxy’s TCP port must be open.

  • Old links stopped working

    The secret changed, which happens after a FakeTLS domain change. Send out the new link from mtg access.

  • SNI-DNS warning at startup

    The domain in the secret does not point at the server IP. With someone else’s domain this is expected and does not stop the proxy; for DNS and SNI to match you need your own domain with an A record on the VPS.

  • After an update: domain-fronting-ip is ignored

    Since 2.3.0 the option has no effect. Replace domain-fronting-ip or [domain-fronting].ip with [domain-fronting].host, which takes a name or an IP.

  • You need an ad tag, and mtg has none

    mtg v2 has no tag. Install the official MTProxy and register it with @MTProxybot; for a proxy with a tag the mtg author also suggests the telemt project.

Telegram proxy FAQ

No answer here? Message @ExpressHost_SupportBot.

What is MTProxy and how is it different from a VPN?

MTProxy is a proxy for Telegram only: the app reaches its servers through your VPS from a tg://proxy link. A VPN sends all device traffic through the server and needs a separate app. For Telegram alone MTProxy is simpler: nothing to install on the phone.

How do I add a proxy in Telegram?

Open the tg://proxy or t.me/proxy link on a device with Telegram, or scan the QR code, and the app offers to add the proxy. By hand: in the proxy settings choose MTProto and enter the server, port and secret.

MTProto or SOCKS5: which one for Telegram?

Telegram supports both. The SOCKS5 handshake is in the clear, while MTProxy in FakeTLS mode looks like TLS to an ordinary website and connects from one link with no username or password. SOCKS5 helps when other apps need the same proxy.

Can I share the proxy with friends?

Yes, there is one link for everyone: mtg has no user management. The mtg author advises sharing the proxy with a small circle and never announcing it publicly, since public proxies are the first to get blocked by IP. The only way to revoke access is a new secret.

Can I add a sponsored channel to the proxy?

Not with mtg v2: the author removed it. The ad tag comes from the @MTProxybot bot for Telegram’s official MTProxy; for a proxy with a tag the mtg author also suggests the telemt project.

What VPS does a Telegram proxy need?

The minimum in our library is 1 vCPU, 1 GB RAM and 10 GB of disk: the mtg author designs it for 10–20 thousand simultaneous connections. All our VPS run on KVM; the cheapest matching plan is 1 vCPU, 2 GB RAM and 10 GB NVMe for $2.79 a month in Poland.

Will the proxy work if the server hosts a website?

Yes, as long as they do not share a port: publish the proxy on 8443, for example, or put mtg on 443 in front of the website, and it passes stray requests to the web server through the [domain-fronting] section.

Is there a traffic limit?

Traffic is unlimited by volume, and DDoS protection is included. Speed is capped by the location port: in the Netherlands 10 Gbps, in Germany 25 Gbps, in Poland 5 Gbps, in Estonia 10 Gbps.

Sources

Commands and steps were checked against the mtg README and source code, the official MTProxy and the Telegram documentation on November 3, 2026. The one-command install is the MTProto Proxy card of our library.

Your own MTProxy — one command on a VPS.