在多站点应用程序设置中使用完整域

发布于 2024-07-15 18:19:44 字数 194 浏览 4 评论 0原文

我正在构建一个多站点应用程序,其中客户端必须能够使用自己的域(而不是仅使用子域)。 我想知道不同的方法,以及当/如果客户希望在外部处理电子邮件托管时两端需要什么配置。

任何对 lxadmin/hypervm 的引用也会有帮助。 tx~

编辑: 我正在运行阿帕奇; 没有 SSL 要求。

i'm building a multi-site application where a client must be able to use his own domain (as oppose to just a subdomain). i like to know the different ways to go about it, and what configuration is needed on both end when/if the client wishes to handle email hosting externally.

any reference to lxadmin/hypervm would be helpful too. tx~

edit:
i'm running apache; no ssl requirement.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

神经暖 2024-07-22 18:19:44

这与 wordpress.com 中博客的工作方式类似。 xyz.wordpress.com 可以映射到 www.xyz.com。

Wordpress MU 具有相同的功能,并且有插件可以做到这一点。 这个链接会给你一些想法。

基本上,我认为当客户端请求将其域映射到其站点(在子域中)时,我们添加一个插件域并向用户提供名称服务器的详细信息。 一旦设置完毕,重定向就应该可以工作。 如果我发现更多有用的链接,我会添加更多内容。

This is something similar to how blogs in wordpress.com work. xyz.wordpress.com can be mapped to www.xyz.com.

Wordpress MU has the same feature and there are plugins to do it. This link will give you some idea.

Basically I think when ever a client request to map his domain to his site (in subdomain) we add an addon domain and give the details of name servers to the user. Once they are set the redirection should work. I will add more if I find any more useful links.

沙与沫 2024-07-22 18:19:44

我建议在 apache conf 目录中创建一个子目录。 类似 conf/user-domains 的内容。 该目录中的每个文件都将按照用户的域进行命名,例如 userdomain.com,并且将包含该子域的 apache 指令。 类似的东西(在我的脑海中):

<VirtualHost *:80>
   ServerName userdomain.com
   DocumentRoot "/path/to/userdomain.com/htmldocs/"
</VirtualHost>

假设您有一些网络界面供用户创建这些域,它会在某个已知位置存储一个包含其设置的文件,例如 $webtmp/userrequests/request -XXXYYZ。 然后,您将有一个 cron 作业来扫描该位置以查找新请求,并在 conf/user-domains 中创建匹配文件。

哦,帮我一个忙,不要只是将用户的输入复制到配置文件中 - 这是劫持服务器的好方法。 首先检查它,如果合法则清除它。 (我进一步建议您将 conf/user-domains 的只写访问权限授予用户 fakedaemonuser,并以该用户身份运行 cron-job。)

编辑:忘了告诉你,你需要在 apache 的主配置文件(通常是 http.conf)中添加一条指令:

Include conf/user-domains/*.conf

当然,这是假设你在 conf/ 中创建的所有文件user-domain/ 以 .conf 结尾。

I'd recommend creating a subdirectory in the apache conf directory. Something like conf/user-domains. Each file in that directory would be named like the user's domain, such as userdomain.com, and would contain the apache directives for that subdomain. Something like (off the top of my head):

<VirtualHost *:80>
   ServerName userdomain.com
   DocumentRoot "/path/to/userdomain.com/htmldocs/"
</VirtualHost>

Assuming you have some web-interface for the user to create those domains, it would store a file with his settings in some known location, such as $webtmp/userrequests/request-XXXYYZ. You'd then have a cron-job that would scan that location for new requests, and create matching files in conf/user-domains.

Oh, and do me a favor, and don't just copy input from the user into the config file - that's a great way to get your server hijacked. Check it first, and untaint it if it's legal. (I'd further recommend you give write-only access to conf/user-domains to a user fakedaemonuser, and run the cron-job as that user.)

EDIT: Forgot to tell you, you'll need to add a directive in apache's main config file (http.conf usually):

Include conf/user-domains/*.conf

Of course, that's assuming all the files you're creating in conf/user-domain/ end in .conf.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文