November 13, 2014 03:33AM
Hi,

It works, but i am still able to access the php files inside the restricted directories. I tried with :

location /myfolder/(.+)\.php$ {
deny all;
}

But this doesn't work!

Also, i cannot make this method work nice with our clean url's. We are using :

location / {
#try_files $uri $uri/ /index.php;
#try_files $uri/ $uri /index.php?$query_string;
include /etc/nginx/naxsi.rules;
try_files $uri $uri.html $uri/ @extensionless-php;

}

location @extensionless-php {
rewrite ^(.*)$ $1.php last;
allow all;
}

thank you in advance for your help,

Carl
Subject Author Posted

How to use Nginx to restrict access to everyfiles to 127.0.0.1, except the php files in /

carlg November 12, 2014 05:26AM

Re: How to use Nginx to restrict access to everyfiles to 127.0.0.1, except the php files in /

Maxim Dounin November 12, 2014 06:26AM

Re: How to use Nginx to restrict access to everyfiles to 127.0.0.1, except the php files in /

carlg November 13, 2014 03:33AM

Re: How to use Nginx to restrict access to everyfiles to 127.0.0.1, except the php files in /

carlg January 08, 2015 05:49PM

Re: How to use Nginx to restrict access to everyfiles to 127.0.0.1, except the php files in /

Maxim Dounin November 13, 2014 07:56AM

Re: How to use Nginx to restrict access to everyfiles to 127.0.0.1, except the php files in /

B.R. January 09, 2015 02:00PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 266
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