Welcome! Log In Create A New Profile

Advanced

Deny PHP for Directory

Posted by mcules 
Deny PHP for Directory
July 05, 2010 09:42AM
Hello Nginx'ler,

we migrated from Apache2 to nginx and all is working so far.
The only thing what we dont get working is to deny php for some directorys.

Anybody know how to do that?

Thanks for your help and sorry for my bad english.
Re: Deny PHP for Directory
July 16, 2010 12:42AM
Just add a location block prior to where you're hitting your first php block. The order of location blocks matters. I believe regex takes precedence and the more refined one also takes more precedence. This means that a location block prior to handle this will keep that from happening.

Example:

location /private_php/ { return 403; }
location / { try_files $uri $uri/ /index.php; }
Re: Deny PHP for Directory
July 16, 2010 12:43AM
Sorry, only registered users may post in this forum.

Click here to login

Online Users

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