改变APACHE2的主目录(即网站的根目录)

本文介绍了如何更改Apache2服务器的默认网站根目录,并提供了具体的配置步骤。通过修改httpd.conf文件中的DocumentRoot设置,可以轻松地将根目录指向自定义的位置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

如果把apache2安装到了C盘,则其默认主目录或者说网站的根目录是:“C:/Program Files/Apache Group/Apache2/htdocs”

但为了方便,可以将这个目录改为自己愿意的一个目录,如:“D:/phpwebroot”,则需修改“C:/Program Files/Apache Group/Apache2/conf”中的文件:httpd.conf:修改的地方如下面红色标识处,改为自己想要的目录:

所需注意的是有两处修改,而不是一处:

#
DocumentRoot "D:/phpwebroot"

#

# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features. 
#
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>

#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "D:/phpwebroot">

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值