xampp Apache DocumentRoot跨分区配置要点及Access forbidden解决方法

xampp Apache DocumentRoot跨分区配置要点及Access forbidden解决方法

 

linux下可以随便配置成绝对路径了,因为分区是被挂载到一个文件夹下的,与文件夹地址等同。相对路径的话是相对xampp的安装位置的。

window下配置规则一样,需要注意一点的就是分隔符要用”/“而不是””。跨分区直接添加盘符即可,比如“DocumentRoot “F:/root”。

修改DocumentRoot后,可能出现“Access forbidden”,权限不对所致。找到“<Directory “/xampp/htdocs”>”,将/xampp/htdocs同步修改为配置的DocumentRoot,或者模仿结构重新配置一条也可以,即“<Directory “F:/root”>“。

 

xampp 中提供了添加域名实例:(把前面的## 都去掉) 路径: xamppapacheconfextrahttpd-vhosts.conf

 

 

 

<VirtualHost *:80>

    ServerAdmin [email protected]

    DocumentRoot “F:/xampp/htdocs/dummy-host.localhost”

    ServerName dummy-host.localhost

    ServerAlias www.dummy-host.localhost

    ErrorLog “logs/dummy-host.localhost-error.log”

    CustomLog “logs/dummy-host.localhost-access.log” combined

</VirtualHost>


 

<Directory “F:/xampp/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.2/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:

    #   Options FileInfo AuthConfig Limit

    #

    AllowOverride All


    #

    # Controls who can get stuff from this server.

    #

    Require all granted

</Directory>

 


把 localhost 的目录配置给设置回来。
<VirtualHost *:80>
DocumentRoot /xampp/htdocs/
ServerName localhost
</VirtualHost>



文章来源:http://hi.baidu.com/jlusuoya/item/1de1550ec8378577bfe97ee0