问题现象:

 

访问 nginx  的url 后面的路径不加 /访问不到页面  ,返回404

配置如下:

...

server xxx;

listen 80

location /asdf/company {
root /usr/share/nginx/html;

if (-d $request_filename){
rewrite ^/(.*)([^/])$ $scheme://$host:30091/$1$2/ permanent;
}
}

...

 

 

配置说明

通过配置

if (-d $request_filename){
rewrite ^/(.*)([^/])$ $scheme://$host:30091/$1$2/ permanent;
}

判断url 是否带有/ 如果没有就添加即可。

 

注意location 的路径后面不加/ , 否则如果url 不加/ 那么就404

相关文章:

  • 2021-04-15
  • 2022-12-23
  • 2022-01-21
  • 2022-12-23
  • 2021-12-10
  • 2022-12-23
  • 2021-09-10
  • 2022-01-07
猜你喜欢
  • 2022-12-23
  • 2021-10-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-06
相关资源
相似解决方案