All checks were successful
Build docker and publish / build (20.15.1) (push) Successful in 6m10s
38 lines
1.4 KiB
Plaintext
38 lines
1.4 KiB
Plaintext
server {
|
|
listen 80;
|
|
server_name localhost; # 请修改为您实际的域名,如 ppanel.example.com
|
|
|
|
# ----------------------------------------------------
|
|
# 1. Nginx Status (探针/监控端点)
|
|
# ----------------------------------------------------
|
|
# 用于 nginx-exporter 采集 Nginx 自身指标 (连接数、请求数等)
|
|
location /nginx_status {
|
|
stub_status on;
|
|
access_log off;
|
|
|
|
# 允许 Docker 容器和本地访问
|
|
allow 127.0.0.1;
|
|
allow 172.16.0.0/12; # Docker bridge 默认网段
|
|
allow 192.168.0.0/16; # Docker Desktop for Mac/Windows 网段
|
|
allow 10.0.0.0/8; # 其他常见私有网段
|
|
deny all;
|
|
}
|
|
|
|
# ----------------------------------------------------
|
|
# 2. PPanel Server (后端 API)
|
|
# ----------------------------------------------------
|
|
# 将请求转发到宿主机 8080 端口 (docker-compose 中暴露的端口)
|
|
location / {
|
|
proxy_pass http://127.0.0.1:8080;
|
|
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;
|
|
|
|
# WebSocket 支持 (如果需要)
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection "upgrade";
|
|
}
|
|
}
|