免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3159 | 回复: 0
打印 上一主题 下一主题

[Web] 配置Apache+php多端口多站点 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-12-12 15:05 |只看该作者 |倒序浏览
监听多个端口
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# 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
Listen 8081
Listen 8082
Listen 8083
#增加监听端口


等以下内容都设置以后,可以通过netstat -n -a查看端口是否开启
开启虚拟站点
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
#修改为
# Virtual hosts
Include conf/extra/httpd-vhosts.conf


配置PHP模块
加载php模块,php5apache2_2代表使用的是 apache 2.2或以上版本
LoadModule php5_module "c:/php/php5apache2_2.dll"
PHPIniDir "C:/php"


配置php文件类型映射
AddType application/x-httpd-php .php

上面这一步之前已经配置过了,所以就不用再弄了。
配置conf/extra/httpd-vhosts.conf
<VirtualHost *:8082>
     ServerAdmin
webmaster@dummy-host.localhost
     DocumentRoot "C:/PhpDocRoot/Site1"
     ServerName localhost
     ServerAlias localhost
     ErrorLog "logs/dummy-host.localhost-error.log"
     CustomLog "logs/dummy-host.localhost-access.log" common
     <Directory "C:/PhpDocRoot/Site1">  
         Options Indexes FollowSymLinks
         AllowOverride None
         Order allow,deny
         Allow from all
     </Directory>
</VirtualHost>


<VirtualHost *:8083>
     ServerAdmin
webmaster@dummy-host2.localhost
     DocumentRoot "C:/PhpDocRoot/Site2"
     ServerName localhost
     ErrorLog "logs/dummy-host2.localhost-error.log"
     CustomLog "logs/dummy-host2.localhost-access.log" common
     <Directory "C:/PhpDocRoot/Site2">  
         Options Indexes FollowSymLinks
         AllowOverride None
         Order allow,deny
         Allow from all
     </Directory>
</VirtualHost>


<Directory...>...</Directory>一定不能少
重新启动apache试一下,如果出错,查看一下logs下面的log文件还有windows的事件查看器记录的错误日志。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP