Home php教程 php手册 如何用Apache2将多个网站的域名绑定

如何用Apache2将多个网站的域名绑定

Jun 06, 2016 pm 08:37 PM
DNS

Windows下Apache2不同域名解析不同目录实现方法 ,需要的朋友可以参考下

配置环境
系统: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服务,用以上域名访问

【相关教程推荐】

1. php编程从入门到精通全套视频教程
2. php从入门到精通 
3. bootstrap教程

 

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)