我用的是nginx,说说禁止方法:
- location /wp-content/uploads/ {
- location ~ .*\.(php)?$ {
- deny all;
- }
- }
插入你的nginx conf中,重启nginx即可.
附上一个完整的虚拟主机的例子供参考:
- server
- {
- listen 80;
- server_name bbs.vpser.net;
- index index.html index.htm index.php;
- root /home/wwwroot/phpfensi.com;include discuz.conf;
- location /wp-content/uploads/ {
- location ~ .*\.(php)?$ {
- deny all;
- }
- location ~ .*.(php
- php5)?$
- {
- fastcgi_pass unix:/tmp/php-cgi.sock;
- fastcgi_index index.php;
- include fcgi.conf;
- }
- access_log off;
- }
添加完执行:/usr/local/nginx/sbin/nginx -t测试配置文件,执行:/usr/local/nginx/sbin/nginx -s reload 载入配置文件使其生效.