繁体   English   中英

Wamp文档根目录未更新

[英]Wamp document root is not updating

刚安装完WampServer 3.0.4。 我想进行设置,以便当我访问http:// localhost /时 ,它在e:/Archives/提供文件,而不是默认的WampServer页面。

方法

我找到了很多答案,说我必须打开c:/wamp/bin/apache/apache2.4.18/conf/httpd.conf并查找DocumentRoot和Directory行(我在250行附近找到了它们)。 我将其替换为:

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

有了这个:

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

注意,仅更新的两件事是文档根目录和目录路径。

我的问题

现在,当我将浏览器指向http://localhost ,它仍在 C:\\wamp\\www\\index.php显示相同的默认WampServer页面。 单击phpinfo()链接将显示以下内容:

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

...这使我相信对httpd.conf所做的更改没有任何影响。

有人遇到过这个问题吗? 是否有其他方法可以更改localhost指向的默认位置? 我尝试过重新启动WampServer,重新启动计算机(运行Windows 7)等。

更新httpd.conf DocumentRoot不起作用,因为WampServer自动创建了默认的虚拟主机。

可以在以下位置找到:

C:\\ wamp64 \\ bin \\ apache \\ apache2.4.23 \\ conf \\ extra \\ httpd-vhosts.conf

因此,要么更新此文件,要么创建第二个虚拟主机。

可能尝试在本地主机上启动新的VirtualHost。

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

或者,如果这不是您的解决方案,并且您完全确定已更改有关C:/wamp/www任何行,则应尝试降级到WampServer2。通常可以解决大多数Apache问题。

但是,这很可能发生,因为您没有将第230行的DocumentRoot更改为 DocumentRoot "e:/Archives"

此外,Apache 2.4.9之上的任何版本均无法正常运行,因此我应降级至2.5。 请注意。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM