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


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

如果您真的想允许从宇宙中访问您的网站,那么

Require all granted 

是 Apache 2.4 语法吗

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

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

另外,请记住在修改这些文件后重新启动 Apache。

最新更新