不同端口上的 Apache 虚拟主机不起作用

Apache virtual host on different ports doesn't work

我正在尝试在我的本地主机上提供不同的文件夹。我正在使用 Windows OS.

我想在 localhost:8080 上投放 E:/Programming/Projects,在 localhost:80

上投放 E:/htdocs

我的httpd-vhosts.conf文件是这样的:

Listen 8080
<VirtualHost *:8080>
    ServerName localhost
    DocumentRoot "E:/Programming/Projects"
    <Directory "E:/Programming/Projects">
        AllowOverride All
    </Directory>

</VirtualHost>

当我尝试导航 localhost:80 时,此端口运行良好。但是 localhost:8080 给出了这个错误:

403 - Forbidden
You don't have permission to access this resource.

我已经重置了我的服务器,但它不起作用。

正确答案是:

Listen 8080

<VirtualHost *:8080>
    ServerName localhost:8080
    DocumentRoot "E:/Programming/Projects/"
    <Directory "E:/Programming/Projects/">
        Options +Indexes +FollowSymLinks +MultiViews
        require all granted
    </Directory>
</VirtualHost>