dti3914 2016-09-13 23:17
浏览 46
已采纳

Wamp文档根目录未更新

Just finished installing WampServer 3.0.4. I want to set it up so when I visit http://localhost/, it serves the files within e:/Archives/, instead of the default WampServer page.

Approach

I found many answers that say I have to open c:/wamp/bin/apache/apache2.4.18/conf/httpd.conf and look for both the DocumentRoot and Directory lines (I found them around line 250). I substituted this:

DocumentRoot "c:/wamp/www"
<Directory "c:/wamp/www/">
    #...
    Options +Indexes +FollowSymLinks
    #...
    AllowOverride all
    #   onlineoffline tag - don't remove
    Require local
</Directory>

with this:

DocumentRoot "e:/Archives/"
<Directory "e:/Archives/">
    #...
    Options +Indexes +FollowSymLinks
    #...
    AllowOverride all
    #   onlineoffline tag - don't remove
    Require local
</Directory>

Notice the only two things updated were the Document Root and Directory paths.

My problem

Now, when I point my browser to http://localhost, it still shows the same default WampServer page in C:\wamp\www\index.php. Clicking on the phpinfo() link shows the following:

DOCUMENT_ROOT  C:/wamp/www
CONTEXT_DOCUMENT_ROOT C:/wamp/www 

... which leads me to believe that my changes to httpd.conf aren't making any difference.

Has anybody ran into this issue? Is there a different way to change the default location that localhost points to? I've tried restarting WampServer, restarting my computer (Running Windows 7), etc.

  • 写回答

2条回答 默认 最新

  • dpb75177 2016-09-13 23:50
    关注

    Possibly try starting a new VirtualHost on localhost.

    <VirtualHost localhost:80>
    DocumentRoot "E:/Archives"
    ServerName localhost
    <Directory "E:/Archives">
        Order allow,deny
        Allow from all
        Options Indexes FollowSymLinks
        AllowOverride all
        #   onlineoffline tag - don't remove
        Require all granted
    </Directory>
    </VirtualHost>
    

    Or, if that isn't the solution for you, and you are absolutely sure you changed any lines regarding C:/wamp/www, then you should try downgrading to WampServer 2. Usually that fixes most Apache problems.

    However, this is most likely happening because you didn't change the DocumentRoot at line 230 to DocumentRoot "e:/Archives"

    Also, anything above Apache 2.4.9 doesn't work well, so I should downgrade to 2.5. Just so you know.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)
  • ¥20 matlab yalmip kkt 双层优化问题