解决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/";

 

posted @ 2017-12-05 15:49  Adtuu  阅读(1940)  评论(0编辑  收藏  举报