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

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
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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft