简体   繁体   English

Apache首选的DocumentRoot路径

[英]Apache preferred DocumentRoot path

I'm wondering is there a difference of having my site within the /var/www or /home/myuser/public/sites . 我想知道在/var/www/home/myuser/public/sites中有我的网站有什么区别。 Just seen some tutorials that points to the former then others to the latter, but didn't mentioned some key benefits of having it placed there. 刚刚看到一些指向前者的教程,然后是其他指向后者的教程,但没有提到将它放在那里的一些关键好处。 If you know some articles that explains this best please share it with me. 如果你知道一些解释最好的文章,请与我分享。

Huge thanks. 非常感谢。

The main difference that I can think of from one directory to another is if it's on a separate partition and you set different flags, such as noexec or nosuid . 我可以想到从一个目录到另一个目录的主要区别在于它是否在一个单独的分区上并且您设置了不同的标志,例如noexecnosuid Apart from that, the actual directory you use doesn't matter. 除此之外,您使用的实际目录无关紧要。

However, with that said, by default a user's home directory is created within /home , so especially in something like a shared hosting server, it makes sense to have the DocumentRoot as a sub-directory of the user's home directory, which allows them to easily modify the files without having to worry about them needing give them permissions to leave their home directory, and thus making it easy to "lock" them in by things such as FTP or SFTP with chroot. 然而,据说,默认情况下,用户的主目录是在/home创建的,特别是在共享托管服务器之类的东西中,将DocumentRoot作为用户主目录的子目录是有意义的,这允许他们轻松修改文件,而不必担心他们需要授予他们离开主目录的权限,从而可以轻松地通过FTP或SFTP与chroot等“锁定”它们。

There are no pros or cons sir. 先生没有利弊。 You have the freedom to use what you want to. 你可以自由地使用你想要的东西。

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

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