我們常規的做法是將統一入口文件、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/";