How can I point multiple domains to one server?

核能气质少年 提交于 2020-02-28 17:27:06

问题


I have a VPS that's barely being used. I would love to point several domains I have (through a registrar somewhere else) to different folders of this VPS. Is there any way to do this?

For example:

helloomgwtf.com -> 111.111.111.111/hello
hitherehowareyou.com -> 111.111.111.111/hithere
thirdrandomdomain.com -> 111.111.111.111/random

I'm entirely new to setting stuff up, so detailed explanations would really be appreciated.

Thanks!


回答1:


You are looking for Virtual Hosts.

NameVirtualHost *:80 
<VirtualHost *:80>
  ServerName helloomgwtf.com
  DocumentRoot /var/www/vhosts/hello
</VirtualHost>

<VirtualHost *:80>
  ServerName hitherehowareyou.com
  DocumentRoot /var/www/vhosts/hithere
</VirtualHost>

<VirtualHost *:80>
  ServerName thirdrandomdomain.com
  DocumentRoot /var/www/vhosts/random
</VirtualHost>

Rackspace has pretty good info on this here.



来源:https://stackoverflow.com/questions/20228872/how-can-i-point-multiple-domains-to-one-server

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!