本文介绍了不同端口上的Apache虚拟主机不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在本地主机上提供不同的文件夹.我正在使用Windows操作系统.
I'm trying to serve different folders on my localhost. I'm using Windows OS.
我想在 localhost:8080
上提供 E:/Programming/Projects
,并在 localhost上提供
E:/htdocs
:80
I want to serve E:/Programming/Projects
on localhost:8080
, and E:/htdocs
on localhost:80
我的 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会出现此错误:
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.
推荐答案
正确的答案是:
Listen 8080
<VirtualHost *:8080>
ServerName localhost:8080
DocumentRoot "E:/Programming/Projects/"
<Directory "E:/Programming/Projects/">
Options +Indexes +FollowSymLinks +MultiViews
require all granted
</Directory>
</VirtualHost>
这篇关于不同端口上的Apache虚拟主机不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!