[英]apache php Virtualhost
我正在尝试在我的系统中实现虚拟主机。
我已经使用了以下代码。
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
---------------------------------------------------------
任何人都可以解决这个问题。
您的ServerName有一个“o”,主机文件条目是“oo”(两个)。
一旦你解决了这个错字,它有用吗?
如果在目录中没有包含索引。[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
选项更新您的vhosts文件。
<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/"
希望这可以帮助。
OS X的权限等设置(开箱即用)以便从/Users/shanker/Sites
提供Web文档,因此,如果这是与权限相关的问题,您可能只是尝试将代码移动到/Users/shanker/Sites/content_booking/
目录并更新DocumentRoot
指令以支持任何权限问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.