如何使用 Nginx 反向代理 ASF-ui
如何在成功运行 ASF 的机子上用 Nginx 实现在指定路径访问 ASF-ui
例如,想通过 example.com/asf
访问 ASF-ui,则修改 Nginx 配置如下
location /asf/api/nlog {
proxy_pass http://127.0.0.1:1242/api/nlog;
# proxy_set_header Host 127.0.0.1; # Only if you need to override default host
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Real-IP $remote_addr;
# We add those 3 extra options for websockets proxying, see https://nginx.org/en/docs/http/websocket.html
proxy_http_version 1.1;
proxy_set_header Connection "Upgrade";
proxy_set_header Upgrade $http_upgrade;
}
location /asf/ {
proxy_pass http://127.0.0.1:1242/;
# proxy_set_header Host 127.0.0.1; # Only if you need to override default host
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Real-IP $remote_addr;
}
参考