Trailing slash/redirection issue NGINX

我只是一个虾纸丫 提交于 2020-01-25 10:04:52

问题


I am using Drupal 8 with nginx . I have a multiProject Environment with single domain. I have 10 Drupal sites. which works as https://example.com/site1 https://example.com/site2 Each site has its on distinct docker container and everything is running smooth on production. But I noticed A issue with few sites. They give 404 without a trailing slash .Only 4 of them. Rest six automatically appends the slash when I remove them and hit in browser. The nginx config for all are exactly same. Here is the nginx config for a site :

server
   {
   client_max_body_size 128m;
   root /var/www/html;
   index index.php index.html index.htm;
   location /site1 {
      try_files $uri/ $uri /site1/index.php?$query_string;
   }
    error_page 404 /404.html;
    error_page 403 /403.html;
  # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  location ~ \.php$ {
     try_files $uri $uri/ /index.php?q=$uri&$args;
     fastcgi_split_path_info ^(.+\.php)(/.+)$;
     fastcgi_pass 127.0.0.1:9000;
     fastcgi_index index.php;
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
     include fastcgi_params;
     add_header Access-Control-Allow-Origin *;
     proxy_set_header Access-Control-Allow-Origin $http_origin;
  }
}    

I have tried every thing , rewrite, try files and returns. can any one help.

来源:https://stackoverflow.com/questions/49436579/trailing-slash-redirection-issue-nginx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!