https://github.com/subhajit-maji/mtproxy-docker
Self-hosted Telegram MTProxy server using Docker with simple setup, firewall config, and optional promotion tag support.
https://github.com/subhajit-maji/mtproxy-docker
docker mtproxy networking proxy proxy-server self-hosted telegram telegram-proxy ubuntu vpn vps
Last synced: about 5 hours ago
JSON representation
Self-hosted Telegram MTProxy server using Docker with simple setup, firewall config, and optional promotion tag support.
- Host: GitHub
- URL: https://github.com/subhajit-maji/mtproxy-docker
- Owner: subhajit-maji
- Created: 2026-06-17T11:04:24.000Z (10 days ago)
- Default Branch: subhajit-maji
- Last Pushed: 2026-06-17T11:08:00.000Z (10 days ago)
- Last Synced: 2026-06-17T13:08:29.045Z (10 days ago)
- Topics: docker, mtproxy, networking, proxy, proxy-server, self-hosted, telegram, telegram-proxy, ubuntu, vpn, vps
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MTProxy Docker
A simple, production-ready Telegram MTProxy deployment using Docker.
## Features
- ✅ Docker-based deployment
- ✅ Supports Telegram MTProxy
- ✅ Custom secret support
- ✅ Promotion tag support
- ✅ Uses port 443
- ✅ Automatic restart (`unless-stopped`)
- ✅ Compatible with Ubuntu 20.04, 22.04 and 24.04
- ✅ Can be used with either a public IP or a DNS hostname
- ✅ Easy to maintain and update
## Requirements
- Linux server (Ubuntu recommended)
- Docker installed
- TCP port `443` open in the firewall and cloud security rules
- Public IPv4 address
- (Optional) Domain name pointing to the server
## Clone
```bash
git clone https://github.com/subhajit-maji/mtproxy-docker.git
cd mtproxy-docker
```
## Configuration
Create a `.env` file from the example:
```bash
cp .env.example .env
```
Edit `.env`:
```text
SECRET=YOUR_SECRET
TAG=YOUR_PROMOTION_TAG
```
## Prerequisites
- Docker Engine installed
- Docker Compose v2 plugin installed
On Ubuntu/Debian:
```bash
sudo apt update
sudo apt install -y docker-compose-v2
```
Verify the installation:
```bash
docker compose version
```
## Start
```bash
docker compose up -d
```
## Stop
```bash
docker compose down
```
## Restart
```bash
docker compose restart
```
## View logs
```bash
docker compose logs -f
```
## Verify
Check that the container is running:
```bash
docker ps
```
Check that port 443 is listening:
```bash
sudo ss -ltnp | grep :443
```
## Telegram proxy links
Using an IP address:
```
tg://proxy?server=YOUR_SERVER_IP&port=443&secret=YOUR_SECRET
```
Using a domain name:
```
tg://proxy?server=YOUR_DOMAIN&port=443&secret=YOUR_SECRET
```
## Cloudflare DNS
If using Cloudflare:
- Create an **A** record pointing to your server IP.
- Set the record to **DNS only** (grey cloud).
- Do **not** enable Cloudflare proxying for MTProxy traffic.
## Troubleshooting
### Domain resolves but Telegram cannot connect
- Confirm the domain points to the correct server IP.
- Confirm TCP port 443 is open.
- Confirm Docker is running.
- Confirm the MTProxy container is healthy.
- If using Cloudflare, ensure the DNS record is **DNS only**.
### Connection refused
Check:
```bash
docker ps
sudo ss -ltnp | grep :443
```
### Container logs
```bash
docker logs mtproxy
```
## Security
- Do not publish your production secret.
- Do not commit your `.env` file to GitHub.
- Use `.env.example` with placeholder values instead.
## Update
Pull the latest changes from the repository and recreate the container:
```bash
git pull
docker compose pull
docker compose up -d
```
## Repository Structure
```text
.
├── .env.example
├── .gitignore
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── SECURITY.md
├── docker-compose.yml
├── docs/
│ ├── setup.md
│ └── cloudflare-dns.md
└── scripts/
├── install.sh
├── start.sh
├── stop.sh
├── restart.sh
└── logs.sh
```
## License
MIT