Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Apache Server 403 Nightmare [SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
corona80
n00b
n00b


Joined: 02 May 2007
Posts: 17

PostPosted: Fri Nov 02, 2007 1:28 am    Post subject: Apache Server 403 Nightmare [SOLVED] Reply with quote

I have two apache servers running. One is the production server and is working fine. The other is for development and is giving me a real headache.

The development machine gives a 403 error for any request made. This is usually a file permissions problem with the web roots (/usr/local/www in my case) and is easy enough to fix. Or it's the directory settings in the config files which is easy to fix as well.

After a lot of head banging I copied my production server's configuration (that works) over to the development server to preclude the chance that there was some configuration option I had zoned out on. I also did a side-by-side comparison of the directories on both machines to make sure that they match and to ensure that the apache user and group has read access.

This is the error I get when requesting a page from the development server:
Code:
 # tail -n 1 /var/log/apache2/error_log
[error] [Thu Nov 01 18:05:07 2007] [client ***.***.***.***] client denied by server configuration: /usr/htdocs

Apache does not apear to be using the vhosts I've configured:
Code:
 Listen 80
NameVirtualHost a.domain.tld:80

<VirtualHost a.domain.tld:80>
   DocumentRoot "/usr/local/www/a.domain.tld/htdocs"
   <Directory "/usr/local/www/a.domain.tld/htdocs">
      Options -Indexes FollowSymLinks
      AllowOverride None
      Order allow,deny
      Allow from all
   </Directory>
</VirtualHost>

<VirtualHost b.domain.tld:80>
   DocumentRoot "/usr/local/www/b.domain.tld/htdocs"
   <Directory "/usr/local/www/b.domain.tld/htdocs">
      Options -Indexes FollowSymLinks
      AllowOverride None
      Order allow,deny
      Allow from all
   </Directory>
</VirtualHost>

It's like Apache is defaulting to /usr/htdocs for some reason.

Any idea what is going on?


Last edited by corona80 on Fri Nov 02, 2007 10:23 am; edited 1 time in total
Back to top
View user's profile Send private message
corona80
n00b
n00b


Joined: 02 May 2007
Posts: 17

PostPosted: Fri Nov 02, 2007 10:05 am    Post subject: Reply with quote

After some more tinkering I discovered that setting NameVirtualHost to *:80 and the first vhost to <VirtualHost *:80> will at least get things partly working.

The virtual host labeled *:80 works but it overrides all of the other vhosts. Thats what I would expect at least.

What this suggests to me is that the server is not able to "see" domain names so name based vhosts don't work. If that is true, it makes sense that without a *:80 virtual host the server has no host suitable to work from. It must be trying to fill in the blanks like using /usr/htdocs as a document root.

I feel closer to a solution but I'm not sure where to go from here.
Back to top
View user's profile Send private message
corona80
n00b
n00b


Joined: 02 May 2007
Posts: 17

PostPosted: Fri Nov 02, 2007 10:31 am    Post subject: Reply with quote

After carefully reading the Apache manual I realized that name based virtual hosts have to be defined "<VirtualHost *:80>" to work right. That's because Apache first looks for a VirtualHost that has a matching IP and then looks at the ServerName directives in the virtual hosts for a match.

My development machine is behind a firewall that is just doing port forwarding so my configuration from the production server, which has it's own unique IP address, would not work.

I should really update my production server's configuration. Even though it works, having it setup as is shown in my first post does not make much sense.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum