引荐:《PHP教程》
1、制止某一个目次实行php
location ~* ^/download/.*\.(php|php5)$ { deny all; }
2、制止多个目次实行php
location ~* ^/(download|down)/.*\.(php|php5)$ { deny all; }
注重:要写在php设置前,下面是一个示例
location ~* ^/(download|down)/.*\.(php|php5)$ { deny all; } location ~ [^/]\.php(/|$) { try_files $uri =404; fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_index index.php; include fastcgi.conf; }
以上就是nginx制止指定目次运转php的细致内容,更多请关注ki4网别的相干文章!