在何处放置web服务器根?

时间:2022-10-06 08:17:58

I've just made an upgrade and now partly thinking on web-server directory structure for local workstation for web-development on linux platform. Running multiple hosts and different projects required. Where is it better to put all the server's docroots? /var/www? /srv? /www? I plan to make it as separate partition - could it be good for backups? :) I'm looking forward to your thoughts on this.

我刚刚进行了升级,现在部分地考虑了linux平台上用于web开发的本地工作站的web服务器目录结构。需要运行多个主机和不同的项目。在哪里放置所有服务器的docroot更好?/var/www吗?/电脑?/ www吗?我计划将它作为一个独立的分区—它对备份有好处吗?我期待着你对这件事的看法。

3 个解决方案

#1


3  

For development, you could put the files anywhere - perhaps in your home directory (you can allow Apache to serve files from your home directory by setting UserDir enabled in the Apache configuration: see http://httpd.apache.org/docs/2.1/mod/mod_userdir.html).

对于开发,您可以将文件放在任何位置——可能是在您的主目录中(您可以通过在Apache配置中设置UserDir来允许Apache从您的主目录中提供文件:请参见http://httpd.apache.org/docs/2.1/mod/mod_userdir.html)。

For production, /srv/www is probably the best place for the files; this is (loosely) defined in the FHS: http://www.pathname.com/fhs/pub/fhs-2.3.html#SRVDATAFORSERVICESPROVIDEDBYSYSTEM

对于生产来说,/srv/www可能是文件最好的地方;这在FHS中(松散地)定义:http://www.pathname.com/fhs/pub/fhs-2.3.html# srvdataforservicesprovibysystem

Additionally, /srv/www is typically (certainly on Fedora, for example) one of the locations that is regarded by SELinux as web content, which allows Apache to read the files.

此外,/srv/www通常(例如,在Fedora上)是SELinux视为web内容的位置之一,允许Apache读取文件。

#2


0  

Under /srv is the proper place for service data files. Making it a separate volume is not necessary, provided the volume it's on is relatively safe from becoming full.

在/srv下是服务数据文件的适当位置。把它单独设置为一个卷是不必要的,只要它所在的卷相对安全,不会变得满。

#3


0  

It is well explained in the Filesystem Hierarchy Standard. It should go in /srv.

它在文件系统层次标准中得到了很好的解释。它应该进入/srv。

#1


3  

For development, you could put the files anywhere - perhaps in your home directory (you can allow Apache to serve files from your home directory by setting UserDir enabled in the Apache configuration: see http://httpd.apache.org/docs/2.1/mod/mod_userdir.html).

对于开发,您可以将文件放在任何位置——可能是在您的主目录中(您可以通过在Apache配置中设置UserDir来允许Apache从您的主目录中提供文件:请参见http://httpd.apache.org/docs/2.1/mod/mod_userdir.html)。

For production, /srv/www is probably the best place for the files; this is (loosely) defined in the FHS: http://www.pathname.com/fhs/pub/fhs-2.3.html#SRVDATAFORSERVICESPROVIDEDBYSYSTEM

对于生产来说,/srv/www可能是文件最好的地方;这在FHS中(松散地)定义:http://www.pathname.com/fhs/pub/fhs-2.3.html# srvdataforservicesprovibysystem

Additionally, /srv/www is typically (certainly on Fedora, for example) one of the locations that is regarded by SELinux as web content, which allows Apache to read the files.

此外,/srv/www通常(例如,在Fedora上)是SELinux视为web内容的位置之一,允许Apache读取文件。

#2


0  

Under /srv is the proper place for service data files. Making it a separate volume is not necessary, provided the volume it's on is relatively safe from becoming full.

在/srv下是服务数据文件的适当位置。把它单独设置为一个卷是不必要的,只要它所在的卷相对安全,不会变得满。

#3


0  

It is well explained in the Filesystem Hierarchy Standard. It should go in /srv.

它在文件系统层次标准中得到了很好的解释。它应该进入/srv。