当前位置: > Linux服务器 > apache >

Apache服务器 设置虚拟主机的办法!

时间:2014-09-21 00:58来源:linux.it.net.cn 作者:it

1. 打开文件 /etc/httpd/conf/httpd.conf, 搜索 VirtualHost example, 找到代码如下:

# # VirtualHost example: 
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known # server name. 
2.改掉注释,然后根据需要自己修改
<VirtualHost *:80> 
 ServerAdmin ***@***.com 
 DocumentRoot /var/www/drupal 
 ServerName www.***.com 
 ErrorLog logs/dummy-host.log 
 CustomLog logs/dummy-host.log common 
</VirtualHost>

3.重启httpd 服务, 执行以下语句.

service httpd restart

(责任编辑:IT)
------分隔线----------------------------