[英]How to setup two virtual hosts in CentOS?
I have two domains I'm trying to host on the same IP. 我有两个要在同一IP上托管的域。 This is what I've been trying, but it doesn't work: 这是我一直在尝试的方法,但是不起作用:
<VirtualHost host1.me:80>
ServerAdmin admin@menet.me
DocumentRoot /var/www/html/host1/
ServerName host1.me
ErrorLog logs/host1-error_log
CustomLog logs/host1-access_log common
</VirtualHost>
<VirtualHost host2.me:80>
ServerAdmin admin@menet.me
DocumentRoot /var/www/html/host2/
ServerName www.host2.me
ServerAlias host2.me
ErrorLog logs/host2-error_log
CustomLog logs/host2-access_log common
</VirtualHost>
What should I put in my httpd.conf? 我应该在httpd.conf中放入什么?
if you are accessing the urls locally ie on server itself, then u need to add their entries in /etc/hosts file. 如果要在本地访问URL,即在服务器本身上,则需要在/ etc / hosts文件中添加它们的条目。
eg: suppose ur server ip is 192.168.1.1, thn put following entry in hosts file: 例如:假设您的服务器IP为192.168.1.1,则将以下条目放入主机文件:
192.168.1.1 host1.me host2.me www.host2.me 192.168.1.1 host1.me host2.me www.host2.me
save the file... 保存文件...
and then check... 然后检查...
hope this helps :) 希望这可以帮助 :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.