简体   繁体   English

将config.php移出www文件夹

[英]Move config.php out of www folder

I'm starting to set up the security for my web server. 我开始为我的Web服务器设置安全性。 For this, I created a folder outside of my www folder, where I put my config.php. 为此,我在www文件夹之外创建了一个文件夹,在其中放置了config.php。 This file holds sensitive database infos. 该文件包含敏感的数据库信息。

I have two questions: 我有两个问题:

1) Should I rather keep it in the www folder and then move everything else down one level and make my web server point to that new web root? 1)我是否应该将其保留在www文件夹中,然后将其他所有内容下移一个级别并使我的Web服务器指向该新Web根?

2) What permissions should I set? 2)我应该设置什么权限?

currently I have set the 目前我已经设定

owner to root (read-only)

group to root (read-only)

others (read-only) as well

I'm only really worried about others. 我只是真的担心别人。 Should I rather specify a user for it or create a new group altogether? 我应该为其指定用户还是完全创建一个新组? Please also mention any other considerations. 还请提及其他注意事项。 Thanks 谢谢

EDIT: I forgot to mention, my web server distro is Ubuntu 10.10. 编辑:我忘了提一下,我的Web服务器发行版是Ubuntu 10.10。 EDIT2: My web server is nginx EDIT2:我的Web服务器是Nginx

我觉得应该关闭安全模式,但是不建议使用它,或者将config.php移到config /,然后将其放在config / .htaccess中: Deny from All

if you do move your config.php file outside of your www, you may have a openbase_dir issue, which what will not allow that script to be processed as a php file (only on certain server configs.. I think that moving your config file outside of the www folder is unnecessary as long as it is not echoing all that info out. 如果您确实将config.php文件移动到了www之外,则可能会出现openbase_dir问题,该问题将导致该脚本无法作为php文件处理(仅在某些服务器配置上。)我认为将配置文件移动只要不在www文件夹之外,只要它不回显所有这些信息即可。

Keep in mind that if your server is processing php files correctly your server will not reveal the file content to the world. 请记住,如果您的服务器正确处理了php文件,则您的服务器将不会向世界透露文件内容。

so: 1) Keep it in the www folder 2) I set mine to 644 所以:1)保留在www文件夹中2)我将我的设置为644

take a look at this for some more security info: http://www.acunetix.com/websitesecurity/php-security-3.htm 请查看此以获得更多安全信息: http : //www.acunetix.com/websitesecurity/php-security-3.htm

Good luck, Joe 乔,祝你好运

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

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