服务器 Gind.cn

服务器问题集锦,包括 Linux(Ubuntu, Centos,Debian等)和Windows Server服务器

nginx反向代理与NodeJS应用程序和redirect

我一直在研究这个问题太久,所以我需要来请求专家的帮助! 我的查询是非常类似于这里问: nginx代理传递redirect忽略端口,但我相信,我的节点应用程序的行为略有不同。 我正在运行Intel AMT NodeJS应用程序meshcommander( http://www.meshcommander.com/meshcommander ),它在端口3000上提供一个web应用程序。该应用程序在服务器192.168.0.27上运行。 我的nginx服务器在端口80上的同一台服务器上运行,这就是我在主服务器块下设置了反向代理的方式: location /intel { satisfy any; allow 192.168.0.0/24; deny all; auth_basic "Restricted Content"; auth_basic_user_file /etc/nginx/.htpasswd; rewrite /intel(/.*) /$1 break; proxy_pass http://192.168.0.27:3000; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } 我遇到的第一个问题是,当你直接在端口3000上打开节点应用程序时,像这样: http://192.168.0.27:3000 它会redirect到另一个页面: http://192.168.0.27:3000/default.htm 不幸的是,当你转到:nginx反向代理不会自动发生这种情况: http://192.168.0.27/intel 但没有问题,这只是为了调用这个方法: htt://192.168.0.27/intel/default.htm 这很好,但是在使用web应用程序时,最终需要调用局域网上的另一台服务器,以及发生故障的地方。 我可以看到节点应用程序中的某些操作调用页面,如: http://192.168.0.27/intel/webrelay.ashx?p=1&host=10.7.7.6&port=16992&tls=0 它返回一个404,我可以看到这是它被发送的方式: Request URL:http://192.168.0.27/intel/webrelay.ashx?p=1&host=10.7.7.6&port=16992&tls=0 Request method:GET […]