Welcome! Log In Create A New Profile

Advanced

Location Directive Not Working - Help Please

duluxoz
April 16, 2024 02:50AM
Hi All,

Quick Q: Why does the following config not work ie NginX is returning a
404 when I attempt to access a php file/page from the "/common/" location?

Obviously I'm misunderstanding something about how location directives
work  :-)

~~~
location /common/ {
  root /www;
  try_files $uri $uri/ =404;
}
location ~ \.php$ {
  try_files $uri =404;
  deny all;
  include fastcgi_params;
  fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  fastcgi_intercept_errors on;
}
location ~ /\. {
  access_log off;
  log_not_found off;
  deny all;
}
location ~ ~$ {
  access_log off;
  log_not_found off;
  deny all;
}
~~~

Thanks in advance

Cheers

Dulux-Oz
_______________________________________________
nginx mailing list
nginx@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Location Directive Not Working - Help Please

duluxoz April 16, 2024 02:50AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 276
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready