自己内网使用nginx打算像这样 ip/功能1,ip/功能2 这样来访问,但遇到了问题,像这样写
location /newapi {
return 301 $scheme://$host/newapi/;
}
location /newapi/ {
proxy_pass http://192.168.31.108:50002/;
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_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 90;
proxy_ssl_server_name on;
}
会遇到后端资源请求的url 404的问题,像这样写
location / {
proxy_pass http://192.168.31.108:50002/;
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_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 90;
proxy_ssl_server_name on;
}
就又能访问了,资源文件也都找的到了,请问佬们有什么办法解决第一种写法的时候资源文件找不到的问题吗?