为什么apache拒绝请求www.mydomain.org如果mydomain.org工作正常?

这是我为mydomain.org工作的设置:

<VirtualHost *:80> ServerAdmin webmaster@localhost ServerName mydomain.org ServerAlias *.mydomain.org DocumentRoot /var/www/ </VirtualHost> 

如果我请求www.mydomain.org,apache会在日志中添加一个403,并附加以下内容:

(13)Permission denied:/root/.htaccess pcfg_openfile:无法检查htaccess文件,确保它是可读的

我已经尝试将ServerName更改为www.mydomain.org,并将ServerAlias更改为www.mydomain.org,但运气不佳。

我错过了什么?

您是否尝试过实际检查.htaccess文件是否可读(或为什么Apache要读取它)? ServerName应该是mydomain.org,ServerAlias http://www.mydomain.org&#x3002;

你不能在ServerAlias中放置一个星号(*)。 你应该把你想要的名字。 在你的情况下,应写成ServerAlias www.mydomain.orghttp://httpd.apache.org/docs/2.0/mod/core.html#serveralias

编辑:我发现你的问题的东西http://httpd.apache.org/docs/2.0/vhosts/name-based.html 。 我认为你的configuration还有另外一个问题,就像其他的虚拟主机一样,有另一个根目录。

听起来就像你试图做通配符DNS,在这种情况下,你可以使用一个asterix。

这是我发现的一个很好的链接: http : //ma.tt/2003/10/wildcard-dns-and-sub-domains/

此外,与Emthigious一样,检查您的.htaccess文件的权限。