最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

nginx - Access denied unless I add trailing

programmeradmin0浏览0评论

I am trying to add wordpress as a subdirectory into rails, If I try to access the blog root page without trailing / or adding /index.php I get access denied.

 403

/ 200

.php 200

here is my conf:

location /blog {
  root /var/www/example/current;  

  fastcgi_intercept_errors on;
  include fastcgi_params;
  fastcgi_index  index.php;   
  fastcgi_param   PATH_INFO         $fastcgi_path_info;
  fastcgi_param SCRIPT_NAME $fastcgi_script_name;
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

location ~* \.(?:css|js|map|jpe?g|gif|png)$ { }
  index  index.html index.htm index.php;
  try_files $uri $uri/ /index.php?$args;
    fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}

nginx error log:

Access to the script '/var/www/example/current/blog' has been denied (see security.limit_extensions)" while reading response header from upstream

/etc/php/7.2/fpm/pool.d/www.conf:

security.limit_extensions = .php .php3 .php4 .php5 .php7 .js .css

any idea?

I am trying to add wordpress as a subdirectory into rails, If I try to access the blog root page without trailing / or adding /index.php I get access denied.

https://example/blog 403

https://example/blog/ 200

https://example/blog/index.php 200

here is my conf:

location /blog {
  root /var/www/example/current;  

  fastcgi_intercept_errors on;
  include fastcgi_params;
  fastcgi_index  index.php;   
  fastcgi_param   PATH_INFO         $fastcgi_path_info;
  fastcgi_param SCRIPT_NAME $fastcgi_script_name;
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

location ~* \.(?:css|js|map|jpe?g|gif|png)$ { }
  index  index.html index.htm index.php;
  try_files $uri $uri/ /index.php?$args;
    fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}

nginx error log:

Access to the script '/var/www/example/current/blog' has been denied (see security.limit_extensions)" while reading response header from upstream

/etc/php/7.2/fpm/pool.d/www.conf:

security.limit_extensions = .php .php3 .php4 .php5 .php7 .js .css

any idea?

Share Improve this question edited Oct 14, 2019 at 1:47 simo asked Oct 14, 2019 at 1:42 simosimo 1316 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I found the answer, I am putting it here incase it might be useful for someone:

change: location /blog into location /blog/

发布评论

评论列表(0)

  1. 暂无评论