xampp3.2 apache 配置多端口 多域名
2014-09-03 14:46
134 查看
我们本机采用 XAMPP 搭建,底端采用的 APACHE,本文配置方法不仅仅适用于 XAMPP,还适用于任意已安装 APACHE 的机子。我们一起来动手配置下:
XAMPP 安装路径:D:\xampp
*网站根目录:D:\xampp\htdocs 即httpd.conf 下的配置的DocumentRoot目录
*APACHE 所在位置:D:\xampp\apache
配置方法
1、创建 2 个以上不同的网站目录,存放不同的网站程序,小明创建后如下:
(1)D:\xampp\htdocs\dedecms_test(存放织梦程序)
(2)D:\xampp\htdocs\discuz_test(存放 DISCUZ 论坛程序)
注意这两个目录一定要在网站根目录下 即httpd.conf 下的配置的DocumentRoot目录
2、记事本编辑 D:\xampp\apache\conf\httpd.conf,在顶部添加需要被监听的端口:8080、8081,保留默认监听的 80 端口
Listen 80
Listen 8080
Listen 8081
3、如果你想实现不同端口(http://localhost:8080/、http://localhost:8081/)访问不同网站,就需要在httpd-vhosts.conf添加以下:
注:要查看httpd.conf是否开通
# Virtual hosts
Include conf/extra/httpd-vhosts.conf #此句前面无#号
# 多端口虚拟主机配置 #
<virtualhost *:8080>
ServerName localhost
DocumentRoot D:/xampp/htdocs/dedecms_test
</virtualhost>
# dedecms_test #
<virtualhost *:8081>
ServerName localhost
DocumentRoot D:/xampp/htdocs/dedecms_test
</virtualhost>
4、如果你想采用不同域名访问不同网站,就需要配置 2 个域名(可以任意):www.a.com、www.b.com,他们都指向了 127.0.0.1(本机)
(1)记事本打开 C:\Windows\System32\drivers\etc\hosts
(2)在该文件底部添加以下代码并保存:
127.0.0.1 www.a.com
127.0.0.1 www.b.com
httpd-vhosts.conf 下配置
# 多域名虚拟主机配置
<virtualhost *:8080>
ServerName www.a.com
DocumentRoot D:/xampp/htdocs/dedecms_test
</virtualhost>
# dedecms_test #
<virtualhost *:8081>
ServerName www.b.com
DocumentRoot D:/xampp/htdocs/dedecms_test
</virtualhost>
5、最重要的一步,重启 apache 服务。浏览器输入:http://localhost:8080/、http://localhost:8081/、http://www.a.com/、http://www.b.com 试试哇~
XAMPP 安装路径:D:\xampp
*网站根目录:D:\xampp\htdocs 即httpd.conf 下的配置的DocumentRoot目录
*APACHE 所在位置:D:\xampp\apache
配置方法
1、创建 2 个以上不同的网站目录,存放不同的网站程序,小明创建后如下:
(1)D:\xampp\htdocs\dedecms_test(存放织梦程序)
(2)D:\xampp\htdocs\discuz_test(存放 DISCUZ 论坛程序)
注意这两个目录一定要在网站根目录下 即httpd.conf 下的配置的DocumentRoot目录
2、记事本编辑 D:\xampp\apache\conf\httpd.conf,在顶部添加需要被监听的端口:8080、8081,保留默认监听的 80 端口
Listen 80
Listen 8080
Listen 8081
3、如果你想实现不同端口(http://localhost:8080/、http://localhost:8081/)访问不同网站,就需要在httpd-vhosts.conf添加以下:
注:要查看httpd.conf是否开通
# Virtual hosts
Include conf/extra/httpd-vhosts.conf #此句前面无#号
# 多端口虚拟主机配置 #
<virtualhost *:8080>
ServerName localhost
DocumentRoot D:/xampp/htdocs/dedecms_test
</virtualhost>
# dedecms_test #
<virtualhost *:8081>
ServerName localhost
DocumentRoot D:/xampp/htdocs/dedecms_test
</virtualhost>
4、如果你想采用不同域名访问不同网站,就需要配置 2 个域名(可以任意):www.a.com、www.b.com,他们都指向了 127.0.0.1(本机)
(1)记事本打开 C:\Windows\System32\drivers\etc\hosts
(2)在该文件底部添加以下代码并保存:
127.0.0.1 www.a.com
127.0.0.1 www.b.com
httpd-vhosts.conf 下配置
# 多域名虚拟主机配置
<virtualhost *:8080>
ServerName www.a.com
DocumentRoot D:/xampp/htdocs/dedecms_test
</virtualhost>
# dedecms_test #
<virtualhost *:8081>
ServerName www.b.com
DocumentRoot D:/xampp/htdocs/dedecms_test
</virtualhost>
5、最重要的一步,重启 apache 服务。浏览器输入:http://localhost:8080/、http://localhost:8081/、http://www.a.com/、http://www.b.com 试试哇~
相关文章推荐
- XAMPP Apache 配置多端口和多域名方法
- XAMPP Apache 配置多端口和多域名方法
- XAMPP Apache 配置多端口和多域名方法
- XAMPP Apache 配置多端口和多域名方法
- XAMPP集成环境下apache配置多端口多站点访问
- XAMPP中apache配置本地多根目录多端口
- XAMPP Apache 配置多端口和多域名方法
- XAMPP Apache 配置多端口和多域名方法
- XAMPP Apache 配置多端口和多域名方法
- XAMPP Apache 配置多端口和多域名方法
- 改变Apache端口等配置修改方法
- (转载)Xampp环境apache无法启动(端口未被占用)
- IIS Apache冲突 改变Apache端口等配置修改方法
- Apache 多域名同端口同IP配置
- Apache本机不同端口多站点配置:httpd-vhosts.conf
- 图文讲解:搭建xampp + testlink +bugfree 测试管理环境及修改xampp 的Apache、MySQL端口
- apache 本地配置虚拟主机,单ip多域名
- apache 配置多端口
- apache配置多站点(不同端口)
- mac下配置apache支持多个端口