Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

This is the setup I have working for mydomain.org:

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

If I request www.mydomain.org, apache throws a 403 with the following appended to the log:

(13)Permission denied: /root/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

I've tried changing ServerName to www.mydomain.org, and changing ServerAlias to www.mydomain.org as well with no luck.

What am I missing?

share|improve this question

3 Answers 3

Have you tried actually checking whether the .htaccess file is readable (or why Apache wants to read it)? ServerName should be mydomain.org, ServerAlias www.mydomain.org.

share|improve this answer

You ou can not put an star (*) in ServerAlias. You should put the name you want. In your case, ServerAlias www.mydomain.org should be written. http://httpd.apache.org/docs/2.0/mod/core.html#serveralias

Edit : I found something http://httpd.apache.org/docs/2.0/vhosts/name-based.html for your problem. I think there is another problem in your configuration, like an other virtual host, with an other root directory.

share|improve this answer
    
Yes, there was another problem. I am on Ubuntu; I have been editing /etc/apache2/sites-available/default and I had also edited /etc/apache2/httpd.conf earlier adding another VirtualHost stanza. Which is more correct to use out of the two files if I'm looking to set up several virtual hosts matching different subdomains? –  sendos Apr 2 '10 at 23:47
    
Create a file in /etc/apache2/sites-available for each virtualhost you have. Don't forget to activate it with a2ensite file Then each virtualhost is easy to find and to manage. Check debian-administration.org/articles/412 –  Dom Apr 4 '10 at 16:09

Sounds like you are trying to do wildcard DNS, in this case you CAN use an asterix.

Here's a good link I found: http://ma.tt/2003/10/wildcard-dns-and-sub-domains/

Also, siding with Emthigious, check your .htaccess file permissions.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.