项目部署到/app路径上,以下有两种nginx配置。
可以正确访问到应用,但会从 /app 301 到 /app/,目前不希望出现跳转。
server {
listen 80;
server_name ng.ct.com;
expires 7d;
location /app {
root D:/code;
index index.html;
try_files $uri $uri/ /app/index.html;
}
}
不可以正确访问到应用,为什么???
如果要在这种配置下正确访问,应该还需要做什么?
server {
listen 80;
server_name ng.ct.com;
expires 7d;
location /app {
root D:/code/app;
index index.html;
try_files $uri $uri/ /index.html;
}
}
最终目的是,可以通过 /app 访问应用,而不出现301跳转。
可以尝试使用端口绑定到app目录,然后用反向代理访问