## 目录
- [概览](#概览)
- [为什么要使用 Marzban?](#为什么要使用-marzban)
- [特性](#特性)
- [安装指南](#安装指南)
- [配置](#配置)
- [文档](#文档)
- [如何使用 API](#如何使用-api)
- [如何备份 Marzban](#如何备份-marzban)
- [Telegram bot](#telegram-bot)
- [捐赠](#捐赠)
- [许可](#许可)
- [贡献者](#贡献者)
# 概览
Marzban(Marzban一词源自波斯语,意为“边境警卫”,发音为 /mærz'ban/)是一个代理管理工具,提供简单易用的用户界面,可管理数百个代理账户,由 [Xray-core](https://github.com/XTLS/Xray-core) 提供支持,使用 Python 和 Reactjs 构建。
## 为什么要使用 Marzban?
Marzban 是一个用户友好、功能丰富且可靠的工具。它让您可以为用户创建不同的代理,无需进行任何复杂的配置。通过其内置的 Web 界面,您可以监视、修改和限制用户。
### 特性
- 内置 **Web 界面**
- 完全支持 **REST API** 的后端
- 支持 **Vmess**、**VLESS**、**Trojan** 和 **Shadowsocks** 协议
- 单用户的**多协议**支持
- 单入站的**多用户**支持
- 单端口的**多入站**支持(使用 fallbacks)
- **流量**和**过期日期**限制
- 周期性的流量限制(例如每天、每周等)
- 兼容 **V2ray** 的**订阅链接**(例如 V2RayNG、SingBox、Nekoray 等)和 **Clash**
- 自动化的**分享链接**和**二维码**生成器
- 系统监控和**流量统计**
- 可自定义的 xray 配置
- **TLS** 支持
- 集成的 **Telegram Bot**
- **多管理员**支持(WIP)
# 安装指南
运行以下命令以使用 SQLite 数据库安装 Marzban。
```bash
sudo bash -c "$(curl -sL https://github.com/Gozargah/Marzban-scripts/raw/master/marzban.sh)" @ install
```
运行以下命令以使用 MySQL 数据库安装 Marzban。
```bash
sudo bash -c "$(curl -sL https://github.com/Gozargah/Marzban-scripts/raw/master/marzban.sh)" @ install --database mysql
```
运行以下命令以使用 MariaDB 数据库安装 Marzban。
```bash
sudo bash -c "$(curl -sL https://github.com/Gozargah/Marzban-scripts/raw/master/marzban.sh)" @ install --database mariadb
```
Once the installation is complete:
- You will see the logs that you can stop watching them by closing the terminal or pressing `Ctrl+C`
- The Marzban files will be located at `/opt/marzban`
- The configuration file can be found at `/opt/marzban/.env` (refer to [configurations](#configuration) section to see variables)
- The data files will be placed at `/usr/lib/marzban`
- For security reasons, the Marzban dashboard is not accessible via IP address. Therefore, you must [obtain SSL certificate](https://gozargah.github.io/marzban/en/examples/issue-ssl-certificate) and access your Marzban dashboard by opening a web browser and navigating to `https://YOUR_DOMAIN:8000/dashboard/` (replace YOUR_DOMAIN with your actual domain)
- You can also use SSH port forwarding to access the Marzban dashboard locally without a domain. Replace `user@serverip` with your actual SSH username and server IP and Run the command below:
```bash
ssh -L 8000:localhost:8000 user@serverip
```
Finally, 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
```bash
marzban cli admin create --sudo
```
That's it! You can login to your dashboard using these credentials
To see the help message of the Marzban script, run the following command
```bash
marzban --help
```
If you are eager to run the project using the source code, check the section below