apache nginx設置目錄無執行權限的方法web服務有iis,apache,nginx,使用操作系統無非是windows or *nux
- location ~ ^/upload/.*.(php教程|php5)$
- {
- deny all;
- }
來看倆段通常對上傳目錄設置無權限的列子,配置如下:
- <directory "/var/111cn.net/upload">
- <filesmatch ".php">
- order allow,deny
- deny from all
- </filesmatch>
- </directory>
*nux就不同了,大家都是知道的*nux操作系統是區分大小寫的
- <directory "/var/www/upload">
- <filesmatch "(?i:.php)"> //?是盡可能多的匹配.php的字符串,i是不區分大小寫,然后冒號后面跟上正則表達式
- order allow,deny
- deny from all
- </filesmatch>
- </directory>
另外看一一nginx虛擬主機防webshell完美版 nginx.conf
- server
- {
- listen 80;
- server_name www.a.com;
- index index.html index.htm index.php;
- root /data/htdocs/www.a.com/;
- #limit_conn crawler 20;
- location ~ .*.(php|php5)?$
- {
- #fastcgi_pass unix:/tmp/php-cgi.sock;
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
- include fcgi.conf;
- }
- }
- server
- {
- listen 80;
- server_name www.b.com;
- index index.html index.htm index.php;
- root /data/htdocs/www.companysz.com/;
- #limit_conn crawler 20;
- location ~ .*.(php|php5)?$
- {
- #fastcgi_pass unix:/tmp/php-cgi.sock;
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
- include fcgi.conf;
- }
- }
新聞熱點
疑難解答