修改apache网站根目录方法与修改无效解决方法(笔记)

修改apache网站根目录无效(笔记)
  • 本人是修改apache网站根目录是改http.conf文件与httpd-vhosts.conf文件
  • 其中http.conf在apache根目录下的conf文件夹下,httpd-vhosts.conf在apache根目录下的conf\extra文件夹下
  • 修改完成后重启apache,如果修改结果无效则需要重启电脑!(本人第一次把默认文档htdocs修改为E:/StudyFile/phpAndApache/WWW是成功的,但是第二次修改为F:/code却发现修改无效,apache访问的还是第一次修改的路径,百度好几个方法都没成功!最后重启电脑后成功了!这个处理方法不一定适用所有情形!)
修改内容

http.conf文件中的DocumentRoot "F:/code"
两处改为自己的存放目录

# documents. By default, all requests are taken from this directory, but
#symbolic links and aliases may be used to point to other locations.
#
#DocumentRoot "${SRVROOT}/htdocs" 
#修改apache网站根目录  
#DocumentRoot "E:/StudyFile/phpAndApache/WWW"
#DocumentRoot "E:/StudyFile/phpAndApache/WWW"
#
DocumentRoot "F:/code"

   #
   # 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"

httpd-vhosts.conf文件(有修改过虚拟主机的则需要配,没有则无需修改)
这里我是有配置虚拟主机的,把虚拟主机的DocumentRoot文件根目录改为与http.conf文件相同的根目录


# serverAdmin 为站长邮箱
#    ServerAdmin [email protected]
#  网站根目录
#    DocumentRoot "E:/StudyFile/phpAndApache/WWW"
    DocumentRoot "F:/code"
    ServerName hhh917.com
    ErrorLog "logs/dummy-host2.example.com-error.log"
    CustomLog "logs/dummy-host2.example.com-access.log" common

修改完成后保存文件,重启apache服务!apache网站根目录修改完成!

你可能感兴趣的:(apache)