我正在尝试从 nginx 端口 8100 重定向到 8069。我在 443 和 80 上运行了 apache2。无论我尝试使用 proxy_pass 做什么,我总是最终到达端口 443。
pi@nextcloudpi:/etc/nginx/conf.d $ sudo lsof -nP -iTCP:8100 -sTCP:LISTEN
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
nginx 3009 root 10u IPv4 35397 0t0 TCP *:8100 (LISTEN)
nginx 3010 www-data 10u IPv4 35397 0t0 TCP *:8100 (LISTEN)
nginx 3011 www-data 10u IPv4 35397 0t0 TCP *:8100 (LISTEN)
nginx 3012 www-data 10u IPv4 35397 0t0 TCP *:8100 (LISTEN)
nginx 3013 www-data 10u IPv4 35397 0t0 TCP *:8100 (LISTEN)
pi@nextcloudpi:/etc/nginx/conf.d $ sudo lsof -nP -iTCP:443 -sTCP:LISTEN
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
apache2 851 root 6u IPv6 20709 0t0 TCP *:443 (LISTEN)
apache2 1372 www-data 6u IPv6 20709 0t0 TCP *:443 (LISTEN)
apache2 1373 www-data 6u IPv6 20709 0t0 TCP *:443 (LISTEN)
pi@nextcloudpi:/etc/nginx/conf.d $ sudo lsof -nP -iTCP:8069 -sTCP:LISTEN
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
python3 2176 odoo 4u IPv4 24012 0t0 TCP *:8069 (LISTEN)
pi@nextcloudpi:/etc/nginx/conf.d $
我使用了最简单的反向代理代码:
server {
listen 8100;
access_log /var/log/nginx/reverse-access.log;
error_log /var/log/nginx/reverse-error.log;
location / {
proxy_set_header Host $host;
proxy_set_header User-Agent $http_user_agent;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://localhost:8069;
}
}
有什么建议么?