技术解析
我一个 tomcat 有多个应用,比如我访问 localhost ,我想让 nginx 转发给国外服务器 localhost:8080/hello
我在配置文件里设置
location ~ .*\.(jsp|do)$ {
proxy_pass http://localhost:8080/hello/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
启动的时候会提示
"proxy_pass" cannot have URI part in location given by regular expression,
or inside named location, or inside "if" statement,
or inside "limit_except" block in /etc/nginx/conf.d/default.conf:7
查了查,说是 proxy_pass 后面不能有斜杠,可是都没具体的解决办法,特来 v 站请教