Unified GUI Censorship Resistant Solution Powered by Xray
Unified GUI Censorship Resistant Solution Powered by Xray
Unified GUI Censorship Resistant Solution Powered by Xray
English / فارسی / 简体中文 / Русский
Marzban (the Persian word for "border guard" - pronounced /mærz'ban/) is a proxy management tool that provides a simple and easy-to-use user interface for managing hundreds of proxy accounts powered by Xray-core and built using Python and Reactjs.
Marzban is user-friendly, feature-rich and reliable. It lets you to create different proxies for your users without any complicated configuration. Using its built-in web UI, you are able to monitor, modify and limit users.
Run the following command to install Marzban with SQLite database:
sudo bash -c "$(curl -sL https://github.com/Gozargah/Marzban-scripts/raw/master/marzban.sh)" @ installRun the following command to install Marzban with MySQL database:
sudo bash -c "$(curl -sL https://github.com/Gozargah/Marzban-scripts/raw/master/marzban.sh)" @ install --database mysqlRun the following command to install Marzban with MariaDB database:
sudo bash -c "$(curl -sL https://github.com/Gozargah/Marzban-scripts/raw/master/marzban.sh)" @ install --database mariadbOnce the installation is complete:
Ctrl+C/opt/marzban/opt/marzban/.env (refer to configurations section to see variables)/var/lib/marzbanhttps://YOUR_DOMAIN:8000/dashboard/ (replace YOUR_DOMAIN with your actual domain)user@serverip with your actual SSH username and server IP and Run the command below:ssh -L 8000:localhost:8000 user@serveripFinally, you can enter the following link in your browser to access your Marzban dashboard:
http://localhost:8000/dashboard/
You will lose access to the dashboard as soon as you close the SSH terminal. Therefore, this method is recommended only for testing purposes.
Next, you need to create a sudo admin for logging into the Marzban dashboard by the following command
marzban cli admin create --sudoThat's it! You can login to your dashboard using these credentials
To see the help message of the Marzban script, run the following command
marzban --helpIf you are eager to run the project using the source code, check the section below
Install xray on your machine
You can install it using Xray-install
bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ installClone this project and install the dependencies (you need Python >= 3.8)
git clone https://github.com/Gozargah/Marzban.git
cd Marzban
wget -qO- https://bootstrap.pypa.io/get-pip.py | python3 -
python3 -m pip install -r requirements.txtAlternatively, to have an isolated environment you can use Python Virtualenv
Then run the following command to run the database migration scripts
alembic upgrade headIf you want to use marzban-cli, you should link it to a file in your $PATH, make it executable, and install the auto-completion:
sudo ln -s $(pwd)/marzban-cli.py /usr/bin/marzban-cli
sudo chmod +x /usr/bin/marzban-cli
marzban-cli completion installNow it's time to configuration
Make a copy of .env.example file, take a look and edit it using a text editor like nano.
You probably like to modify the admin credentials.
cp .env.example .env
nano .envCheck configurations section for more information
Eventually, launch the application using command below
python3 main.pyTo launch with linux systemctl (copy marzban.service file to /var/lib/marzban/marzban.service)
systemctl enable /var/lib/marzban/marzban.service
systemctl start marzbanTo use with nginx
…or
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name marzban.example.com;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
location / {
proxy_pass http://0.0.0.0:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}By default the app will be run on http://localhost:8000/dashboard. You can configure it using changing the UVICORN_HOST and UVICORN_PORT environment variables.
You can set settings below using environment variables or placing them in
.envfile.
| Variable | Description |
|---|---|
| SUDO_USERNAME | Superuser's username |
| SUDO_PASSWORD | Superuser's password |
| SQLALCHEMY_DATABASE_URL | Database URL (SQLAlchemy's docs) |
| UVICORN_HOST | Bind application to this host (default: 0.0.0.0) |
| UVICORN_PORT | Bind application to this port (default: 8000) |
| UVICORN_UDS | Bind application to a UNIX domain socket |
| UVICORN_SSL_CERTFILE | SSL certificate file to have application on https |
| UVICORN_SSL_KEYFILE | SSL key file to have application on https |
| UVICORN_SSL_CA_TYPE | Type of authority SSL certificate. Use private for testing self-signed CA (default: public) |
| XRAY_JSON | Path of Xray's json config file (default: xray_config.json) |
| XRAY_EXECUTABLE_PATH | Path of Xray binary (default: /usr/local/bin/xray) |
| XRAY_ASSETS_PATH | Path of Xray assets (default: /usr/local/share/xray) |
| XRAY_SUBSCRIPTION_URL_PREFIX | Prefix of subscription URLs |
| XRAY_FALLBACKS_INBOUND_TAG | Tag of the inbound that includes fallbacks, needed in the case you're using fallbacks |
| XRAY_EXCLUDE_INBOUND_TAGS | Tags of the inbounds that shouldn't be managed and included in links by application |
| CUSTOM_TEMPLATES_DIRECTORY | Customized templates directory (default: app/templates) |
| CLASH_SUBSCRIPTION_TEMPLATE | The template that will be used for generating clash configs (default: clash/default.yml) |
| SUBSCRIPTION_PAGE_TEMPLATE | The template used for generating subscription info page (default: subscription/index.html) |
| HOME_PAGE_TEMPLATE | Decoy page template (default: home/index.html) |
| TELEGRAM_API_TOKEN | Telegram bot API token (get token from @botfather) |
| TELEGRAM_ADMIN_ID | Numeric Telegram ID of admin (use @userinfobot to found your ID) |
| TELEGRAM_PROXY_URL | Run Telegram Bot over proxy |
| JWT_ACCESS_TOKEN_EXPIRE_MINUTES | Expire time for the Access Tokens in minutes, 0 considered as infinite (default: 1440) |
| DOCS | Whether API documents should be availab |
عوض شدن لینک ساب بعد از ریست مرزبان یا رفرش پنل
Mergen
Mergen
آپدیت شدن لینک ساب با رفرش پنل
Bug title
Bug title
Bug titlehttp://YOUR_SERVER_IP:9000
Bug title
Bug title
Bug title