我最近试图用Apache设置测试服务器。该网站必须在域名www.mytest.com
下运行。我总是得到一个403 Forbidden
错误。我在Ubuntu 10.10服务器版上。 doc根目录下的目录/var/www
。以下是我的设置:在/ var/WWW的Apache VirtualHost 403 Forbidden
内容
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 [email protected]
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-data可读)。
如果我从我的桌面输入IP地址,该网站显示正确。我将桌面上的hosts文件更改为指向服务器IP的www.mytest.com
。当我使用它时,我得到403
。由于本网站的许多功能对网站名称敏感,因此我必须能够通过域名访问网站。
另一个时髦的是,即使所有日志文件都正确创建,他们也没有关于此错误的信息。
我卡住了。任何人都可以帮忙吗?
可以添加的内容:'须藤SH -c”。的/ etc/apache2的/ envvars中; apache2 -S“'(虚拟主机列表)和:'sudo sh -c”。的/ etc/apache2的/ envvars中; grep -R Listen/etc/apache2/* | grep -v \“#\”; grep -R NameVirtual/etc/apache2/* | grep -v \“#\”“ ' – regilero
第一个命令返回以下内容: 'VirtualHost配置: 192.168.2.5:* www.mytest.com(/ etc /的Apache2 /网站启用/ mytest.com:1) 语法OK' 第二个返回: '/etc/apache2/ports.conf:Listen 80 /etc/apache2/ports.conf:听443 /etc/apache2/ports.conf:Listen 443 /etc/apache2/conf.d/virtual.conf:NameVirtualHost *' –
尝试http://serverfault.com/ – regilero