Home > Backend Development > PHP Tutorial > Apache2中实现多网站域名绑定的实现方法_PHP

Apache2中实现多网站域名绑定的实现方法_PHP

WBOY
Release: 2016-06-01 12:16:57
Original
852 people have browsed it

Apache

配置环境
系统: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服务,用以上域名访问
Related labels:
DNS
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template