create
创建反向代理站点,生成 Nginx 配置文件、写入数据库、添加防火墙规则。
- 路由:
POST /mod/proxy/com/create/stype - action:
create
输入参数
| 参数名称 | 必选 | 类型 | 描述 |
|---|---|---|---|
| domains | 是 | string | 域名列表,多个用换行符分隔,可带端口如 example.com:8080 |
| proxy_path | 否 | string | 代理路径,默认 / |
| proxy_pass | 是 | string | 代理目标 URL,http:// 或 https:// 开头 |
| proxy_host | 否 | string | 代理 Host 头,默认 $http_host |
| proxy_type | 否 | string | 代理类型,http(默认)或 unix |
| remark | 否 | string | 备注 |
备注
主域名不能为泛解析(包含 *)。代理目标为 https:// 时会自动开启 SNI。
若站点名已存在,会自动追加端口号后缀。
输出参数
| 参数名称 | 类型 | 描述 |
|---|---|---|
| status | bool | 操作结果 |
| msg | string | 提示信息 |
示例
请求
curl -X POST "http://192.168.168.213:8888/mod/proxy/com/create/stype" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "domains=api.example.com&proxy_pass=http://127.0.0.1:3000&proxy_path=/&remark=API服务&request_time=...&request_token=..."
响应
{
"status": true,
"msg": "反向代理项目添加成功!"
}