简体   繁体   English

多个域名指向同一台服务器,但不在同一项目上

[英]Multiple domain names pointing on the same server but not on the same project

I actually have two projects on my server 我的服务器上实际上有两个项目

var/www/
-project1
-project2

I made this vhost to have access to project1 through domain1.com 我使这个虚拟主机可以通过domain1.com访问project1

<VirtualHost xx.xx.xx.xxx:80>
ServerName domain1.com
DocumentRoot /var/www/project1/
</VirtualHost>

so now my main IP is redirecting every request to /var/www/project1/ 所以现在我的主要IP会将每个请求都重定向到/ var / www / project1 /

So how can i access to project2 through domain2.com (or just with something like xx.xx.xx.xxx/project2) ? 那么,如何通过domain2.com(或仅使用xx.xx.xx.xxx/project2之类的东西)访问project2?

I'm not adminsys so it's probably not the good way to do it, can someone explain which is the right way to do to have access to each project through different domain name. 我不是adminsys,所以这可能不是一个好方法,有人可以解释说这是通过不同域名访问每个项目的正确方法。

Thank you for your help and time. 感谢您的帮助和时间。

Much like you did for the first. 就像您第一次一样。 You need to make sure you also have domain2 registered in DNS with the same IP. 您需要确保您还在DNS中注册了具有相同IP的domain2。

<VirtualHost xx.xx.xx.xxx:80>
   ServerName domain2.com
   DocumentRoot /var/www/project2/
</VirtualHost>

If you're using apache version < 2.4, you also need to make sure you have NameVirtualHost *:80 somewhere in your main configuration 如果您使用的Apache版本<2.4,则还需要确保您的主配置中有NameVirtualHost *:80

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

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