在此服务器上找不到请求的URL /。即使httpd-vhosts.conf和主机文件似乎都是正确的

问题描述 投票:0回答:1
<VirtualHost *:80>
    DocumentRoot "C:/wamp64/www/mysite/"
    ServerName gamath
    <Directory "C:/wamp64/www/mysite/">
        AllowOverride All
         Order Deny,Allow  
            Allow from all
            Require local
    </Directory>
</VirtualHost>

这是我的主机文件

127.0.0.1   localhost
127.0.0.1   gamath

::1     localhost
::1     gamath
apache wamp http-status-code-404
1个回答
0
投票

假设您使用的是Apache 2.4,则应该像这样修改httpd-vhosts.conf文件

<VirtualHost *:80>
    DocumentRoot "C:/wamp64/www/mysite/"
    ServerName gamath
    <Directory "C:/wamp64/www/mysite/">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

因为这些是Apache 2.2语法

Order Deny,Allow  
Allow from all

Require local

是Apache 2.4语法

如果您确实希望允许从Universe访问您的网站

Require all granted 

是Apache 2.4语法

一些升级文档https://httpd.apache.org/docs/current/upgrading.html

还要确保在httpd.conf文件中取消了httpd-vhosts.conf的包含

还记得在修改这些文件后重启Apache。

© www.soinside.com 2019 - 2024. All rights reserved.