我无法使用nginx转发请求设置反向代理到位于后端的节点。 我的nginx conf文件是:
server{
listen 80;
server_name 192.168.50.176;
location /stretch {
rewrite /stretch/(.*) /$1 break
proxy_pass http://localhost:3000/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
没有子目录它工作得很好。下面的配置工作:
server{
listen 80;
server_name 192.168.50.176;
location / {
proxy_pass http://localhost:3000/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}