解決nginx下不能require根目錄以外的文件


我們常規的做法是將統一入口文件、css、js這些放在網站根木,其他php文件放到根目錄外部,這個時候nginx訪問是require不到的,需要設定一下

1、vi  /usr/local/nginx/conf/nginx.conf

在http下添加

include fastcgi.conf

:wq保存

2、vi /usr/local/nginx/conf/fastcgi.conf

找到下面的這句

fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/";

修改為(假定你要包含的目錄是/home/wwwroot/default)

fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/:/home/wwwroot/default/";

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM