Jos*_*fel 4 apache macos localhost virtual-hosts httpd.conf
我试图在我的新Mac OSX 10.9上设置我的本地环境.我知道它已经安装了apache,所以我一直在使用它.无论我如何设置我的httpd-vhosts.conf/hosts/httpd.conf文件,我在浏览器上访问localhost或"test.com"时都会不断收到403禁用错误.错误/文件/其他信息如下所示.
这是我访问任一网页时遇到的错误
Forbidden
You don't have permission to access / on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
Run Code Online (Sandbox Code Playgroud)
我的/ private/etc/hosts文件
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
127.0.0.1 test.com
127.0.0.1 www.test.com
Run Code Online (Sandbox Code Playgroud)
我的/private/etc/apache2/httpd.conf文件
This file is in its original form besides the following changes:
Uncommented Include /private/etc/apache2/extra/httpd-vhosts.conf
Run Code Online (Sandbox Code Playgroud)
我的/ private/etc/apache2/extra/httpd-vhosts文件
<VirtualHost *:80>
ServerName localhost
DocumentRoot /Library/WebServer/Documents/
</VirtualHost>
<VirtualHost *:80>
ServerName test.com
ServerAlias www.test.com
DocumentRoot “/Users/[my_name]/Sites/test”
<Directory “/Users/[my_name]/Sites/test”>
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
其他说明
I've created a config file my user account in /private/etc/apache/users/
I've given that file read and write permissions to "everyone"
I've restarted apache after every save to any config file
I've reset the cache on my browser every time I make a change to these files
I have an index.html file set up in my /Users/[my_name]/Sites/test/ folder
Run Code Online (Sandbox Code Playgroud)
使用命令sudo apachectl -t时
Warning: DocumentRoot [/usr/\xe2\x80\x9c/Users/joshwoelfel/Sites/test\xe2\x80\x9d] does not exist
httpd: Could not reliably determine the server's fully qualified domain name, using Joshs-MacBook-Air.local for ServerName
Syntax OK
Run Code Online (Sandbox Code Playgroud)
我不知道在这一点上要尝试什么.我花了几个小时看着人们发布的教程和其他问题.看起来我的文件和权限是正确的!
小智 9
我刚刚解决了这个问题.尝试添加"需要所有授予"而不是"全部允许".
<VirtualHost *:80>
ServerName test.com
ServerAlias www.test.com
DocumentRoot “/Users/[my_name]/Sites/test”
<Directory “/Users/[my_name]/Sites/test”>
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
19248 次 |
| 最近记录: |