我正在尝试在我的系统中实现虚拟主机。
为此,我使用了下面的代码。
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/Users/shanker/Documents/content_booking/"
ServerName content.boking
Alias /booking "/Users/shanker/Documents/content_booking/public/"
</VirtualHost>我还更新了hosts文件,如下所示
127.0.0.1 content.booking
但是我得到了以下错误:
---------------------------------------------------------
Access forbidden!
You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.
If you think this is a server error, please contact the webmaster.
Error 403
---------------------------------------------------------有人能解决这个问题吗?
发布于 2012-04-14 02:59:09
您的ServerName包含一个"o",而您的主机文件条目包含"oo“(两个)。
一旦你修复了那个打字错误,它就能工作了吗?
发布于 2012-04-14 03:05:37
如果不在目录中包含index.html|htm|php,则默认操作可能是列出该目录中的所有文件,或者更常见的是出于安全考虑,以抛出此错误。
http://127.0.0.1/会导致Apache查找index.html|htm|php文件,如果没有这样的文件,并且您的安全性不允许列出该目录(这是不应该的),这就是错误。
在适当的目录中创建一个index.html文件,看看是否有帮助。
发布于 2012-11-08 06:12:12
首先在Apache中检查您的httpd.conf文件,并确保Virtual hosts处于打开状态。(删除'#‘以打开/取消注释)。
#Virtual hosts
Include conf/extra/httpd-vhosts.conf接下来,使用一些Directory选项更新您的vhosts-file。
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/Users/shanker/Documents/content_booking/"
ServerName content.boking
<Directory "C:/Users/shanker/Documents/content_booking/">
Options Indexes FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Alias /booking "/Users/shanker/Documents/content_booking/public/"
希望这能有所帮助。
https://stackoverflow.com/questions/10146605
复制相似问题