简体   繁体   English

具有一个文档根目录的多个 Apache 虚拟主机文件?

[英]Multiple Apache Virtual Host Files with one Document root?

I've set up a single VPS running Apache, with an application installed in /var/www/html/.我设置了一个运行 Apache 的 VPS,并在 /var/www/html/ 中安装了一个应用程序。 I have a domain [example-1.com] to the server IP.我有一个域 [example-1.com] 到服务器 IP。

I'd also like the same application to be served on [example-2.com].我还希望在 [example-2.com] 上提供相同的应用程序。 Something similar to creating an 'Alias' domain.类似于创建“别名”域的东西。

Is it possible to have two Virtual Host Files configured at one document root?是否可以在一个文档根目录下配置两个虚拟主机文件?

Yes, no problem.是没有问题。 The document roots can point wherever you want them to.文档根目录可以指向您想要的任何位置。 If the configuration of the second virtualhost is the same, you could also use theServerAlias directive.如果第二个虚拟主机的配置相同,您也可以使用ServerAlias指令。

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

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