解决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