首页 > Web开发 > 详细

Apache2.4 多端口虚拟目录配置

时间:2016-05-05 14:18:44      阅读:183      评论:0      收藏:0      [点我收藏+]

步骤1.首先打开AppServ\Apache2.4\conf里面的httpd.conf文件。在里面找到:
LoadModule rewrite_module modules/mod_rewrite.so这行,将他前面的“#”去掉。

步骤2.找到:Include conf/extra/httpd-vhosts.conf将他前面的“#”去掉。(很关键)

步骤3: 添加端口,找到Listen 添加端口如下
#Listen 12.34.56.78:80
Listen 8888
Listen 8081

步骤4:到AppServ\Apache2.4\conf\extra里面的httpd-vhost.conf文件打开,在最后一行添加:

<VirtualHost 127.0.0.1:8081>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "E:/testservername/JQuery/CJSource/JS"
ServerName testservername
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common

<Directory "E:/testservername/JQuery/CJSource/JS">
Options Indexes MultiViews
AllowOverride none
Require all granted
</Directory>
</VirtualHost>

PS:127.0.0.1:8081 可改为*:8081,8081为新添加的端口
DocumentRoot "E:/testservername/JQuery/CJSource/JS" 这个是新端口对应的虚拟路径
ServerName testservername 对应的域名,尽量不要写成localhost,避免和默认的域名localhost冲突

最后修改host文件:默认在C:\Windows\System32\drivers\etc目录下
在host文件中最后一行添加:127.0.0.1 testservername

重启Apache ,在浏览器输入:testservername:8081或者 127.0.0.1:8081 即可访问虚拟路径

Apache2.4 多端口虚拟目录配置

原文:http://www.cnblogs.com/stormyun-117/p/5461502.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!