nginx禁止指定目录运行php
推荐:《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的详细内容,更多请关注教程集其它相关文章!
您可能感兴趣的文章:
nginx禁止指定目录运行php
dedecms目录执行php脚本的限制方法
CentOS6.1部署nginx、php(包括fastcgi)、虚拟主机配置
避坑!用 Docker 搞定 PHP 开发环境搭建
EpiiServer 简易的php nginx环境定制化方案
thinkPHP5运行在nginx上的配置方法详解
PHP-FPM与Nginx的通信机制总结
隐藏PHP版本的方法 PHP基本安全设置
php-fpm配置文件详解
多规则替换过滤nginx模块nginx_substitutions_filter