配置linux下虚拟主机的朋友能用的到,一个备份,感谢作者假设VPS的IP是58.130.17.168,有两个域名指向该IP,分别是domain1.com,domain2.com,
修改/etc/httpd/conf/httpd.conf,在文件的最后加入:
ServerName58.130.17.168
NameVirtualHost58.130.17.168
<VirtualHost58.130.17.168>
ServerNamedomain1.com
DocumentRoot/var/www/domain1.com
<Directory"/var/www/domain1.com">
OptionsIndexesFollowSymLinks
AllowOverrideNone
Orderallow,deny
Allowfromall
</Directory>
</VirtualHost>
<VirtualHost58.130.17.168>
ServerNamedomain2.com
DocumentRoot/var/www/domain2.com
<Directory"/var/www/domain2.com">
OptionsIndexesFollowSymLinks
AllowOverrideNone
Orderallow,deny
Allowfromall
</Directory>
</VirtualHost>
然后在/var/www/domain1.com和/var/www/domain2.com下创建不同的index.html文件:
echo"domain1">/var/www/domain1.com/index.html
echo"domain2">/var/www/domain2.com/index.html
在浏览器里输入http://domain1.com和http://domain2.com即可看到效果了
上一篇:iis 权限设置
下一篇:iis 防盗链_防盗链设置方法