《Nginx下WordPress附件目錄禁止運(yùn)行PHP》要點(diǎn):
本文介紹了Nginx下WordPress附件目錄禁止運(yùn)行PHP,希望對(duì)您有用。如果有疑問(wèn),可以聯(lián)系我們。
我用的是nginx,說(shuō)說(shuō)禁止辦法:DEDECMS案例
- location /wp-content/uploads/ {
- ?
- location ~ .*\.(php)?$ {
- ?
- deny all;
- ?
- }
- ?
- }
插入你的nginx conf中,重啟nginx即可.DEDECMS案例
附上一個(gè)完整的虛擬主機(jī)的例子供參考:DEDECMS案例
- 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;
- ?
- }
添加完執(zhí)行:/usr/local/nginx/sbin/nginx -t測(cè)試設(shè)置裝備擺設(shè)文件,執(zhí)行:/usr/local/nginx/sbin/nginx -s reload 載入設(shè)置裝備擺設(shè)文件使其生效.?DEDECMS案例
《Nginx下WordPress附件目錄禁止運(yùn)行PHP》是否對(duì)您有啟發(fā),歡迎查看更多與《Nginx下WordPress附件目錄禁止運(yùn)行PHP》相關(guān)教程,學(xué)精學(xué)透。維易PHP學(xué)院為您提供精彩教程。
轉(zhuǎn)載請(qǐng)注明本頁(yè)網(wǎng)址:
http://www.snjht.com/jiaocheng/13753.html