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