代碼如下 復制代碼
location ~ /(attachments|upload)/.*.(php|php5)?$ {
deny all;
}
將attachments、upload這二個目錄的PHP執行權限去掉。
附,完整的虛擬主機配置:
代碼如下 復制代碼
server{
listen 80;
server_name www.51qgj.com;
index index.html index.htm index.php;
root /home/wwwroot/w123;
include discuz.conf;
location ~ /(attachments|upload)/.*.(php|php5)?$ {
deny all;
}
location ~ .*.(php|php5)?$
{
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
access_log off;
}