码迷,mamicode.com
首页 > Web开发 > 详细

PHP 配置多站点多目录

时间:2015-07-29 11:39:45      阅读:138      评论:0      收藏:0      [点我收藏+]

标签:

Apache配置httpd.conf

#增加监听端  可以通过netstat -n -a查看端口是否开启
# 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 80
Listen 8081
#开启虚拟站点
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
 
配置conf/extra/httpd-vhosts.conf

<VirtualHost *:8081>
ServerAdmin webmaster@dummy-host.localhost
DocumentRoot "E:\Ken\work_space\PHP\e4"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/dummy-host.localhost-error.log"
CustomLog "logs/dummy-host.localhost-access.log" common
  <Directory "E:\Ken\work_space\PHP\e4">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

就这样重启服务就可以了。

可能会碰到xampp Apache Access forbidden! Error 403 错误。

方法:配置httpd.conf

<Directory />
#AllowOverride none
#Require all denied
Order deny,allow
Allow from all
</Directory>

重启服务,搞定!

方法2:配置conf/extra/httpd-vhosts.conf

<VirtualHost *:8081>
    ServerAdmin webmaster@dummy-host.localhost
    DocumentRoot "E:\Ken\work_space\PHP\e4"
    ServerName localhost
    ServerAlias localhost
    ErrorLog "logs/dummy-host.localhost-error.log"
    CustomLog "logs/dummy-host.localhost-access.log" common   
    <Directory "E:\Ken\work_space\PHP\e4">  
          Options Indexes FollowSymLinks Includes ExecCGI 
                AllowOverride All 
                Require all granted
  </Directory>
</VirtualHost>

 

PHP 配置多站点多目录

标签:

原文地址:http://www.cnblogs.com/kenwong/p/4685228.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!