Apache多站点配置,Apache站点配置


完成整个站点配置需要设置三个文件:
1.httpd.conf:

DocumentRoot "D:/Documents/web_ft_cc"
<Directory "D:/Documents/web_ft_cc">//此处对应站点文件的地址
    #
    # 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 Includes ExecCGI

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

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>
<Directory "D:/Documents/fuotuo_com">//第二个站点文件的地址
    #
    # 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 Includes ExecCGI

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

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

2.httpd-vhosts.conf文件中增加新站点相关信息:

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "D:/Documents/web_ft_cc"//对应站点文件位置
    ServerName www1.weft.cc //站点名
    ErrorLog "logs/www1.weft.cc-error.log"
    CustomLog "logs/www1.weft.cc-access.log" common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "D:/Documents/fuotuo_com"//站点位置
    ServerName www1.fuotuo.com//站点名
    ErrorLog "logs/www1.fuotuo.com-error.log"
    CustomLog "logs/www1.fuotuo.com-access.log" common
</VirtualHost>

3.在自己的文件中的windows/system32/drivers/etc里的hosts文件:增加内容如下:

127.0.0.1   www1.weft.cc  //站点一的访问地址
127.0.0.1   www1.fuotuo.com //站点二的访问地址

相关内容

    暂无相关文章