Apache virtual host on different ports doesn't work

試著忘記壹切 提交于 2021-02-10 14:36:18

问题


I'm trying to serve different folders on my localhost. I'm using Windows OS.

I want to serve E:/Programming/Projects on localhost:8080, and E:/htdocs on localhost:80

My httpd-vhosts.conf file is like that:

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

</VirtualHost>

When I attempt to navigate localhost:80, this port works well. But localhost:8080 gives this error:

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

I've reset my server, but it doesn't work.


回答1:


The correct answer is:

Listen 8080

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


来源:https://stackoverflow.com/questions/65962030/apache-virtual-host-on-different-ports-doesnt-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!