LNMP/A的open_basedir问题

军哥的LNMP/LNMPA的默认保护措施open_basedir挺不错的,就是无意中会错杀一些使用,95%的应用是不需要修改的,但是也有5%的例外

LNMP 1.2及更高版本防跨目录功能使用.user.ini,该文件在网站根目录下,可以修改open_basedir的值来设置限制目录的访问。
.user.ini文件无法直接修改,而且是隐藏文件可能在winscp下可能无法看到,建议使用vim编辑器或nano编辑器进行修改。
如要修或删除需要先执行:chattr -i /网站目录/.user.ini
修改完成后再执行:chattr +i /网站目录/.user.ini
.user.ini不需要重启一般5分钟左右生效。
如果要更改网站目录必须要按上述方法修改防跨目录的设置,否则肯定报错!!

LNMPA或LAMP 1.2上的防跨目录的设置使用的对应apache虚拟主机配置文件里的php_admin_value open_basedir参数进行设置。如果不需要设置可以在前面加 # 进行注释,或自行修改目录的限制。
重启apache生效。

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.