简体   繁体   English

禁止以root身份访问php.ini和phpinfo.php

[英]Block access to php.ini and phpinfo.php in root

I read another question on how to do this, and the most highlighted solution was the following: 我阅读了有关如何执行此操作的另一个问题,最突出的解决方案是:

<Files php.ini>
order allow,deny
deny from all
</Files>

I can't really fiddle with this without knowing for sure, since I don't have any testing environment or anything. 由于我没有任何测试环境或任何东西,因此我不确定是否真的不能摆弄这个。

My question is, can I add multiple files to the same rule for denying access? 我的问题是,我可以向同一规则添加多个文件以拒绝访问吗? What would the formatting be to add additional files to the same deny rule above? 将其他文件添加到上面相同的拒绝规则的格式是什么?

Help is appreciated. 感谢帮助。 Thank you. 谢谢。

You can use regular expressions per the manual entry for <Files> , or <FilesMatch> : 您可以<Files><FilesMatch> 每个手动条目中使用正则表达式:

<FilesMatch "/(phpinfo\.php|php\.ini)">
    order allow,deny
    deny from all
</FilesMatch>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM