Apache的虚拟主机403禁止 [英] Apache VirtualHost 403 Forbidden

查看:227
本文介绍了Apache的虚拟主机403禁止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近尝试设置一个测试服务器与Apache的。该网站必须在域 www.mytest.com 运行。我总是得到一个 403禁止错误。我在Ubuntu 10.10服务器版。文档根正在目录 /无功/网络。以下是我的设置:

I recently tried to set a test server up with Apache. The site must run under domain www.mytest.com. I always get a 403 Forbidden error. I am on Ubuntu 10.10 server edition. The doc root is under dir /var/www. The following are my settings:

在/ var / WWW的内容

Content of /var/www

ls -l /var/www/

total 12
drwxr-xr-x 2 root root 4096 2011-08-04 11:26 mytest.com
-rwxr-xr-x 1 root root 177 2011-07-25 16:10 index.html

服务器上的主机文件内容(与IP 192.168.2.5)

cat /etc/hosts

127.0.0.1 localhost 
127.0.1.1 americano
192.168.2.5 americano.mytest.com www.mytest.com

# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

网站配置

<VirtualHost *>
ServerAdmin admin@mytest.com
ServerName www.mytest.com
ServerAlias mytest.com

DocumentRoot "/var/www/mytest.com"

ErrorLog /var/log/apache2/mytest-error_log
CustomLog /var/log/apache2/mytest-access_log combined

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/var/www/mytest.com">
Options -Indexes FollowSymLinks
AllowOverride None

Order allow,deny
Allow from all
</Directory>
</VirtualHost>

我在我的文档根没有的.htaccess 文件。在权限设置正确(由www数据读取)。

I have no .htaccess file in my doc root. The permissions are set correctly (readable by www-data).

如果我从我的桌面IP地址类型,网站页面正常显示了。我改变了我的主机桌面上的文件以指向 www.mytest.com 到服务器的IP地址。当我使用它,我得到 403 。由于该网站的许多功能都是网站名称敏感,我必须能够通过域名来访问网站。

If I type in the IP address from my desktop, the site shows up correctly. I changed the hosts file on my desktop to point www.mytest.com to the server's IP. When I use it, I get 403. Since many functions of this site are sitename-sensitive, I have to be able to access the site by the domain name.

另外一个时髦的事情是,即使正确创建的所有日志文件,他们有关于此错误的信息。

Another funky thing is, even if all log files are created properly, they have no information regarding this error.

我卡住了。任何人可以帮助?

I am stuck. Can anybody help?

推荐答案

阿帕奇2.4.3(或者略早),增加了新的安全功能,往往导致这个错误。您也将看到的形式是客户端通过服务器配置被拒绝的日志信息。该功能需要用户身份访问一个目录。它默认在httpd.conf附带的Apache开启。你可以看到该功能的实现与指令

Apache 2.4.3 (or maybe slightly earlier) added a new security feature that often results in this error. You would also see a log message of the form "client denied by server configuration". The feature is requiring a user identity to access a directory. It is turned on by DEFAULT in the httpd.conf that ships with Apache. You can see the enabling of the feature with the directive

Require all denied

这基本上说拒绝访问的所有用户。要解决这个问题,要么删除否认指令(或更好),添加以下指令到要授予访问权限的目录:

This basically says to deny access to all users. To fix this problem, either remove the denied directive (or much better) add the following directive to the directories you want to grant access to:

Require all granted

<Directory "your directory here">
   Order allow,deny
   Allow from all
   # New directive needed in Apache 2.4.3: 
   Require all granted
</Directory>

这篇关于Apache的虚拟主机403禁止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆