六,apache修改默认根文件路径

1,安装完apache后,项目默认根路径是E:Program FilesAppServwww。

默认根路径在httpd.conf中默认配置过了,我们可以通过修改配置文件改变项目默认根路径。

DocumentRoot "E:/PROGRA~1/AppServ/www"
<Directory "E:/PROGRA~1/AppServ/www">
    #
    # 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 All

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

2,开启虚拟主机配置时候,会在httpd-vhosts.conf中进行类似配置,但是httpd-vhosts.conf中配置的目录一定是httpd.conf配置的目录或其子目录。这样httpd-vhosts.conf和httpd.conf同时对根目录进行了配置,我们可以将httpd.conf当做父类,httpd-vhosts.conf为子类,当父类,子类中都有设置时候,以子类为准;如果子类没有设置,以父类设置为准。

  

原文地址:https://www.cnblogs.com/usa007lhy/p/5760916.html