https://github.com/sh4dowbyte/marzban-nginx
https://github.com/sh4dowbyte/marzban-nginx
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sh4dowbyte/marzban-nginx
- Owner: sh4dowByte
- License: mit
- Created: 2025-06-24T13:10:31.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-06-25T11:39:31.000Z (11 months ago)
- Last Synced: 2025-07-18T18:28:45.611Z (11 months ago)
- Size: 536 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
## π§© Marzban + Nginx
**Marzban + Nginx Reverse Proxy** in Docker π³
This repository provides a complete setup using **Docker Compose** to run [Marzban](https://github.com/Gozargah/Marzban) (an Xray management panel) with **Nginx reverse proxy** and **SSL certificate** support.
---
### β¨ Features
* π Nginx reverse proxy for managing VMess, VLESS, Trojan, and Shadowsocks traffic
* π Marzban panel accessible via a public port (`8899`)
* π Xray protocol access only via reverse proxy (no raw port exposure)
* π¦ Persistent configuration to ensure data remains safe even after `docker compose down`
* π§ Compatible with servers without public IPs, optionally integrates with **Cloudflare Tunnel**
---
### π Folder Structure
```
.
βββ docker-compose.yml # Main Docker Compose file
βββ nginx.conf # Main Nginx configuration
βββ xray.conf # Reverse proxy virtual host for all protocols
βββ marzban/
β βββ xray_config.json # Xray configuration (VMess, VLESS, etc.)
```
---
## π Quick Start
Clone this repository and start the services:
```bash
git clone https://github.com/sh4dowByte/marzban-nginx.git
cd marzban-nginx
```
## π Using SSL (Certbot)
To automatically obtain and install an SSL certificate from Let's Encrypt:
```bash
docker compose up certbot
```
Once completed, the SSL files will be available at:
```bash
./cert/xray/xray.crt
./cert/xray/xray.key
```
Then start the services:
```bash
docker compose up -d marzban nginx
```
Make sure your `.env` file is configured:
```env
CERTBOT_HOSTNAME=your.hostname.com
CERTBOT_EMAIL=your@email.com
```
## βοΈ Using Cloudflare Tunnel
To run Marzban + Nginx + Cloudflare Tunnel (without exposing public ports):
```bash
docker compose up -d marzban nginx cloudflared
```
Ensure your `.env` file contains your Cloudflare Tunnel token:
```env
TUNNEL_TOKEN=your_cloudflare_token
```
---
## βοΈ Secure & Easy Access to Marzban via Cloudflare Tunnel
Want to access your **Marzban panel** securely without exposing ports? Use **Cloudflare Tunnel** with a subpath like:
### π Example:

Access Marzban at:
```
https://YOUR_DOMAIN/dashboard
```
---
### βοΈ Marzban Panel Settings Example:
| VMESS | VLESS | TROJAN |
| ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- |
|  |  |  |
---
### β¨ Benefits:
* π **Secure**: No need to expose port 80/443 publicly
* βοΈ **Reliable**: Leverages Cloudflareβs infrastructure β perfect for servers without public IPs
* π― **Custom Path**: Run the panel under a subpath like `/dashboard`
* π‘ **Cost-Effective**: No need for static IP or premium VPS
### β οΈ Cons:
* π **Slight Latency Overhead** : Requests go through Cloudflareβs edge, adding a small delay compared to direct IP access
* π§ **Tunnel Dependency** : If the Cloudflare Tunnel fails, access to your panel is lost (unless you expose it directly too)
* π **Cloudflare Account Required** : You must have a Cloudflare account and configure a domain or use a token
* π§ͺ **Debugging Complexity** : Troubleshooting reverse proxy or path issues can be more complex compared to direct hosting
---
### π Special Thanks
This project was inspired by and greatly benefited from:
π **[Agunxzzz/MarXray](https://github.com/Agunxzzz/MarXray/tree/main)**
An excellent repository that provides a full setup of Marzban + Nginx + Xray, helping lay the foundation for this projectβs automatic integration and robust reverse proxy structure.
---
> Thanks to the open-source community for continuously strengthening the Xray and Marzban ecosystem! πͺπ
---