WordPress的市场巨大,被各种坏人盯上,可能哪天你的程序附件目录里面就被上传了木马,通常被植入了PHP文件,然后远程执行,娃哈哈,懂的,如果把WordPress附件目录里面的PHP禁止运行,就不用担心了.
我用的是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/Vevb.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 载入配置文件使其生效.
新闻热点
疑难解答
图片精选