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

Apache 配置多端口网站

时间:2015-05-21 01:17:45      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:

跳过安装步骤。

1. apache安装目录/conf/httpd.conf,如果你是采用wamp集成环境,那么在 wamp/bin/apache下。

2.  在httpd.conf中,找到  
    #LoadModule vhost_alias_module
    #Include conf/extra/httpd-vhosts.conf   
    去掉前面的#号,这一步是为了加载扩展配置

3. 找到apache安装目录/conf/extra/httpd-vhosts.conf。
    打开文件找到 NameVirtualHost *:80,
    比如我们要添加81的端口,在下面增加一行
    Listen 81

4. 然后找到<VirtualHost *:80> ... </VirtualHost> ,复制一段修改为
    <VirtualHost *:81>
    DocumentRoot "D:/php" 
    ServerName localhost
    ServerAlias localhost 
    </VirtualHost>

5. 配置目录权限
    打开/conf/httpd.conf,找到Directory节点。
    可以修改默认目录权限,也可以单独指定目录权限,分别是:
    修改默认目录权限,即修改Directory节点
        <Directory />
            Options FollowSymLinks
         AllowOverride None
         Order deny,allow
       #Deny from all
         Allow from all
       #允许所有访问
         Satisfy all
    </Directory>

    或者增加如下一段
<Directory "D:/php">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn‘t give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride all

    #
    # Controls who can get stuff from this server.
    #

#   onlineoffline tag - don‘t remove
    Order Allow,Deny
    Allow from all

</Directory>
6. 重启apache服务,查看localhost:81/index.php 已经可以正常运行了

 

Apache 配置多端口网站

标签:

原文地址:http://www.cnblogs.com/codealone/p/4518585.html

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