nginx 配置代理出错
错误信息 "proxy_pass" may not have URI part in location given by regular expression,
我的配置文件
location ~ .*\.(php|jsp|cgi)?$ {
proxy_pass http://192.168.2.1:8080/;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
修改为
location ~ .*\.(php|jsp|cgi)?$ {
proxy_pass http://192.168.2.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
不要加斜杠,否则就会报错。
我的配置文件
location ~ .*\.(php|jsp|cgi)?$ {
proxy_pass http://192.168.2.1:8080/;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
修改为
location ~ .*\.(php|jsp|cgi)?$ {
proxy_pass http://192.168.2.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
不要加斜杠,否则就会报错。
none