Home >php教程 >php手册 >Apache2中实现多网站域名绑定的实现方法_php基础

Apache2中实现多网站域名绑定的实现方法_php基础

WBOY
WBOYOriginal
2016-05-17 09:01:18822browse

配置环境
系统:win7
PHP版本:5.3.x
MYSQL 版本:5.0.27
Apache:2.2.4 (Win32)
设置方法:
打开D:\wamp\bin\apache\Apache2.2.17\conf\httpd.conf
在最后添加
NameVirtualHost *:80

DocumentRoot "D:\wamp\www\bbs"
ServerName www.a.com


配置中应该注意:
ServerName *:80
这里的*可以改为本机ip比如192.168.1.11
NameVirtualHost *:80 VirtualHost *:80 保持原样不改
再到hosts文件里写一句:127.0.0.1 www.a.com
(Hosts文件的位置: - Windows NT/2000/XP/2003/Vista 默认路径: %SystemRoot%\system32\drivers\etc\)
这样域名 a.com就绑到本机根目录下了,相当于 http://localhost 或
http://127.0.0.1 输入 www.a.com 比较方便啊。

启动apache服务,用以上域名访问

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn