Apache的虚拟主机
我想在我的系统中实现虚拟主机。Apache的虚拟主机
我已经使用了下面的代码。
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin [email protected]
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
---------------------------------------------------------
可有人请解决这个问题。
您的ServerName是一个“o”,而您的hosts文件条目是“oo”(两个)。
修复该错字后,它能正常工作吗?
雅只是预订,我在conf文件中正确使用,但在这里我错误地提到了。 – user1306297 2012-04-13 19:05:11
OS X的权限等设置了(在箱子外面)从/Users/shanker/Sites
服务网络文档的话,如果它是一个权限相关的问题,你可能只是尝试有移动你的代码到/Users/shanker/Sites/content_booking/
目录和更新DocumentRoot
指令以侧面解决任何权限问题。
如果您没有在目录中包含索引[html | htm | php],则默认操作可能是列出该目录中的所有文件或更常见的安全性,以引发此错误。
http://127.0.0.1/导致Apache查找索引[html | htm | php]文件,如果没有其中一个,并且您的安全性不允许列出目录(它不应该),则这是错误。
在适当的目录下创建一个index.html文件,看看是否有帮助。
首先在Apache中检查您的httpd.conf文件,并确保虚拟主机处于打开状态。 (删除'#'打开/取消注释)。
#Virtual hosts
Include conf/extra/httpd-vhosts.conf
下次更新您的虚拟主机文件与一些Directory
选项。
<VirtualHost *:80>
ServerAdmin [email protected]
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/"
希望这有助于。
您是否阅读过错误信息?第二行非常清楚问题是什么。 – 2012-04-13 18:51:55
雅我读了这一行,并检查了文件权限。该文件夹具有完整的权限。 – user1306297 2012-04-13 18:54:09
阅读关于“无索引文档”的其他部分 – 2012-04-13 18:54:32