Deploy Telegram MTProxy
The MTProto proxy is a container that automatically sets up a proxy server
MTProxy
Just deployed
/data
Deploy and Host Telegram MTProxy on Railway
Telegram MTProxy is an official proxy server that speaks Telegram's native MTProto protocol. It allows users to access Telegram in regions where the service is restricted or throttled, acting as a lightweight relay between clients and Telegram's core servers — all without decrypting or inspecting user traffic.
About Hosting Telegram MTProxy
Hosting Telegram MTProxy involves running a Docker container that automatically connects to Telegram's core infrastructure and relays client traffic using the MTProto protocol. The server requires minimal configuration — at its simplest, you only need to expose a single port and provide a persistent volume for storing connection secrets. For production use, you may configure custom secrets for DNS load balancing across multiple instances, set worker counts to handle higher connection volumes, and register your proxy with Telegram's @MTProxybot for usage analytics and monetization. The container auto-detects its external IP and fetches Telegram server addresses at startup, though daily restarts are recommended to keep those addresses current.
Common Use Cases
- Providing unrestricted Telegram access in regions with government-level censorship or ISP throttling
- Running a community proxy to serve thousands of concurrent Telegram users with low latency
- Monetizing proxy traffic through Telegram's built-in sponsored channel promotion system
Dependencies for Telegram MTProxy Hosting
- Docker (container runtime)
- A publicly routable IP address with port 443 (or another port) open
- Persistent storage volume for secret retention across restarts
- NTP or chrony for time synchronization (system clock must be within 5 seconds of UTC)
Deployment Dependencies
- telegrammessenger/proxy — Official Docker image from Telegram
- @MTProxybot — Telegram bot for proxy registration and stats
- MTProxy GitHub Repository — Source code and build instructions
Implementation Details
The container accepts the following environment variables for configuration:
# Custom secret (16 bytes, lowercase hex) — supports up to 16 comma-separated secrets
SECRET=00baadf00d15abad1deaa515baadcafe
# Or auto-generate a specific number of secrets
SECRET_COUNT=4
# Advertisement tag (not persistent, must be set on every run)
TAG=3f40462915a3e6026a4d790127b95ded
# Worker count (default: 2, each handles up to 60,000 connections)
WORKERS=16
Monitoring is available via a local-only stats endpoint:
docker exec mtproto-proxy curl http://localhost:2398/stats
Key metrics include active_targets (connected Telegram servers), total_special_connections (inbound clients), and total_max_special_connections (capacity ceiling).
Why Deploy Telegram MTProxy on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Telegram MTProxy on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content
MTProxy
telegrammessenger/proxy