class="area">
1.打Apache\conf\httpd.conf文件,搜索 “Include conf/extra/httpd-vhosts.conf”,确保Include conf/extra/httpd-vhosts.conf前面没有 # 注释符,也就是确保引入了 vhosts 虚拟主机配置文件。
在虚拟主机设置文extra\httpd-vhosts.conf里设置:
取消 NameVirtualHost *:80 前面的 ##,这样就启用了 vhosts.conf ,默认的httpd.conf默认配置失效。虚拟主机配置将只设置在 httpd-vhosts.conf 里。
在Apache\conf\extra\httpd-vhosts.conf 这个文件里面的最后面添加以下代码( C:\ComsenzEXP\wwwroot\ww
)这个是你的网站目录地址,www.moke8.com这个是你要绑定的域名。
<VirtualHost 127.0.0.1:80>
DocumentRoot D:\ComsenzEXP\wwwroot
ServerName www.moke8.com
ServerAlias *
DirectoryIndex index.htm index.php index.html
ErrorLog "logs/test-error_log"
CustomLog "logs/test.log" common
</VirtualHost>
<VirtualHost 127.0.0.2:80>
DocumentRoot D:\ComsenzEXP\www
ServerName moke8.com
ServerAlias *
DirectoryIndex index.htm index.php index.html
ErrorLog "logs/test-error_log"
CustomLog "logs/test.log" common
</VirtualHost>
注:DocumentRoot D:\ComsenzEXP\wwwroot 为网站地址
ServerName QQb4.com 为域名