windwos 下 apache 配置多站点



apache版本:httpd-2.4.27-x64-vc14


官网下载编译后的即可


然后正常安装


1.host文件里面配置


127.0.0.1 www.aaa.com
127.0.0.1 www.bbb.com
127.0.0.1 www.ccc.com


2.修改配置文件 httpd.conf

DocumentRoot "${SRVROOT}/htdocs"
<Directory "${SRVROOT}/htdocs">
    #
    # 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.4/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 None

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>

修改为



ServerName www.aaa.com:80
DocumentRoot "H:/ApacheWeb"
<Directory "H:/ApacheWeb">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>


<VirtualHost www.bbb.com:80>
DocumentRoot "H:/ApacheWeb"
<Directory "H:/ApacheWeb">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>
</VirtualHost>


我这里文件存放的路径就用了一个H:/ApacheWeb 大家可根据自己情况设置不同的项目所在路径,目录下存放一个index.html静态页


3.重启apache服务


4 访问 www.aaa.com 和 www.bbb.com 即可





版权声明:本文为sgear原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。