Location Directive Not Working - Help Please
    duluxoz 
    duluxoz at gmail.com
       
    Tue Apr 16 06:49:09 UTC 2024
    
    
  
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
    
    
More information about the nginx
mailing list