gpt4 book ai didi

apache - 单个用户下的多个域的目录结构应该是什么? ( Apache )

转载 作者:行者123 更新时间:2023-12-05 05:28:04 35 4
gpt4 key购买 nike

我在某个 VPS( friend 的带 cPanel 的 apache 服务器)上有一个帐户,我在那里有一个 public_html 目录。我们有大约 5-6 个网站:

/home/myusername/public_html/domain-1.name/index.php
/home/myusername/public_html/domain-2.name/index.php

但我不喜欢这种方式,我想更好地组织它并且能够为每个网站分离和隔离一些东西。那么如果我这样创建呢:

/home/myusername/websites/domain-1.name/public_html/index.php

/home/myusername/websites/domain-2.name/public_html/index.php and so on

这是构建 Web 目录的正确方法吗?apache 会那样工作吗?也许还有其他一些约定或常见的解决方法?

谢谢

最佳答案

这很好。事实上,我强烈建议不要使用 域文件夹 作为文档根目录,因为典型的 Web 应用程序也会包含不可公开访问的数据(例如配置文件、管理脚本、版本控制文件等)。 )

我个人更喜欢 htdocs 这个名字,我把我的网站放在 /srv/http

例如:

/srv/http/user1/domain1/htdocs/
/srv/http/user1/domain2/htdocs/
/srv/http/user1/domain3/htdocs/
/srv/http/user2/domain4/htdocs/
/srv/http/user3/domain5/htdocs/

这样你就可以将 DocumentRoot 设置为 htdocs 目录,并将其他不打算由 Web 服务器传送的内容放在域目录。

关于apache - 单个用户下的多个域的目录结构应该是什么? ( Apache ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14572197/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com