apache 配置 多端口 多虚拟目录

来源:互联网 发布:银联数据是外包公司吗 编辑:程序博客网 时间:2024/05/18 01:29

1:找到apache的配置文件 httpd.conf 在其中找到

# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80 添加如下监听端口 8081 和 8082

Listen 80
Listen 8081
Listen 8082


2:在httpd.conf 文件最后加上如下代码 设置虚拟目录

NameVirtualhost 192.168.1.150:8082

<virtualhost 192.168.1.150:8082>

DocumentRoot  D:/www/dm_fr/

ServerName 192.168.1.150:8082

</virtualhost>


NameVirtualhost 192.168.1.150:8081

<virtualhost 192.168.1.150:8081>

DocumentRoot  D:/www/dm/

ServerName 192.168.1.150:8081

</virtualhost>


保存 重启apache 即可

访问http://192.168.1.150:8081 即为访问dm项目

访问http://192.168.1.150:8082 即为访问dm_fr 项目