-1

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.com/blog 403

https://example.com/blog/ 200

https://example.com/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?

0

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

change: location /blog into location /blog/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.