Skip to content
Navigation

创建反向代理站点

创建反向代理站点,生成 Nginx 配置文件、写入数据库、添加防火墙规则。

POST
https://your-panel.example.com:8888/mod/proxy/com/create/stype
更新于 查看 Markdown

Request bodyX-WWW-FORM-URLENCODEDrequired

  • request_timestringrequired

    Unix 时间戳。

  • request_tokenstringrequired

    按 API 概览生成的签名。

  • domainsstringrequired

    域名列表,多个用换行符分隔,可带端口如 example.com:8080

  • proxy_passstringrequired

    代理目标 URL,http:// 或 https:// 开头

  • actioncreaterequired

    具体操作名称。

  • proxy_pathoptionalstring

    代理路径,默认 /

  • proxy_hostoptionalstring

    代理 Host 头,默认 $http_host

  • proxy_typeoptionalstring

    代理类型,http(默认)或 unix

  • remarkoptionalstring

    备注

Returns

default

接口响应,业务状态见下方详细说明。

JSON
  • statusoptionalboolean

    操作结果

  • msgoptionalstring

    提示信息

各操作详细说明

createaction=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": "反向代理项目添加成功!"
}

Type to search…

↑↓ navigate↵ selectEsc close