我需要在 Nginx 中创建一个非常简单的映射,将子路径重定向到位于同一子网中的另一台服务器。
我试着把它放在服务器部分
location /tomcatapi/ {
rewrite /tomcatapi/(.*) $1 break;
proxy_pass http://192.168.0.3:8443;
}
Run Code Online (Sandbox Code Playgroud)
但是我访问http://www.myservice.com/tomcatapi/是一个 500 错误页面,在 nginx 日志文件中我有这个错误:
the rewritten URI has a zero length
Run Code Online (Sandbox Code Playgroud)
我在这个 conf 中缺少什么?