38 lines
1.2 KiB
Plaintext
38 lines
1.2 KiB
Plaintext
# 1Panel 新建一个独立网站(例如 token.example.com),把这段贴进该站点配置。
|
||
# 不要改 sub2api.example.com 现有的 location ^~ /。
|
||
#
|
||
# 静态文件放到该站点网站目录,一般是:
|
||
# /www/sites/token.example.com/index/
|
||
# 把 dist 里的文件直接放进去,不要多套一层 dist/。
|
||
#
|
||
# /api/ 反代到本机 Sub2API(8080)。页面自己带 x-api-key。
|
||
|
||
server {
|
||
listen 80;
|
||
listen 443 ssl http2;
|
||
server_name token.example.com;
|
||
|
||
root /www/sites/token.example.com/index;
|
||
index index.html;
|
||
|
||
# 1Panel 会自动插入证书、gzip 等,这里只保留业务 location。
|
||
|
||
location /api/ {
|
||
proxy_pass http://127.0.0.1:8080;
|
||
proxy_http_version 1.1;
|
||
proxy_connect_timeout 300s;
|
||
proxy_send_timeout 300s;
|
||
proxy_read_timeout 300s;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
proxy_set_header X-Forwarded-Proto $scheme;
|
||
proxy_set_header Upgrade $http_upgrade;
|
||
proxy_set_header Connection $http_connection;
|
||
}
|
||
|
||
location / {
|
||
try_files $uri $uri/ /index.html;
|
||
}
|
||
}
|