Home >Backend Development >PHP Tutorial >Disable directory running under nginx php_PHP tutorial
The method of prohibiting directories from executing php under nginx is much simpler, allowing multiple directories to be set
I don’t know if I don’t understand apache. If there is a better way, I hope everyone can point it out for shared learning. thx
Location ~* ^/(attachments|images)/.*.(php|php5|PHP|PHP5)$
{
deny all;
}
When the web directory is not the root directory, or there are multiple directories, it can be
Location ~* ^(/discuz/|/bbs/)/(attachments|images)/.*.(php|php5|PHP|PHP5)$
{
deny all;
}