xampp3.2 apache 配置多端口 多域名
来源:互联网 发布:重庆seo外包服务商 编辑:程序博客网 时间:2024/05/29 14:58
我们本机采用 XAMPP 搭建,底端采用的 APACHE,本文配置方法不仅仅适用于 XAMPP,还适用于任意已安装 APACHE 的机子。我们一起来动手配置下:
XAMPP 安装路径:D:\xampp
*网站根目录:D:\xampp\htdocs 即httpd.conf 下的配置的DocumentRoot目录
*APACHE 所在位置:D:\xampp\apache
配置方法
(2)D:\xampp\htdocs\discuz_test(存放 DISCUZ 论坛程序)
注意这两个目录一定要在网站根目录下 即httpd.conf 下的配置的DocumentRoot目录
Listen 80
Listen 8080
Listen 8081
# Virtual hosts
Include conf/extra/httpd-vhosts.conf #此句前面无#号
# 多端口虚拟主机配置 #
<virtualhost *:8080>
ServerName localhost
DocumentRoot D:/xampp/htdocs/dedecms_test
<virtualhost *:8081>
ServerName localhost
DocumentRoot D:/xampp/htdocs/dedecms_test
</virtualhost>
(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 下配置
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>
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>
<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 试试哇~
0 0
- xampp3.2 apache 配置多端口 多域名
- apache配置多端口|多域名|多子域名
- apache多域名多ip多端口的配置
- XAMPP Apache 配置多端口和多域名方法
- XAMPP Apache 配置多端口和多域名方法
- XAMPP Apache 配置多端口和多域名方法
- XAMPP Apache 配置多端口和多域名方法
- XAMPP Apache 配置多端口和多域名方法
- XAMPP Apache 配置多端口和多域名方法
- XAMPP Apache 配置多端口和多域名方法
- apache配置多域名站点和多端口站点
- nginx配置多端口多域名访问
- apache 配置多端口
- apache配置多端口
- apache配置多端口
- 配置 apache 多端口
- apache 多端口配置
- Apache多端口配置
- 生活的宁静 生活的踏实
- 为什么网站需要https?
- JVMS Specification(3)-The class File Format
- avro学习入门一
- 统计文件内容行数
- xampp3.2 apache 配置多端口 多域名
- 麦蒂自曝8月曾同科比合练 未来有望复出再战NBA
- 三大框架ssh中导入导出EXCEL数据
- android ScrollView滚动距离和判断滚动停止状态
- POJ 3264 Balanced Lineup
- Silverlight Grid网格线
- 指向指针的指针 char **使用技巧
- UDP点对点通讯、广播通讯、多播通讯
- 获取Odoo中由Bazaar管理的例子源代码