Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem w/virtual hosts

Status
Not open for further replies.

daniguzman

Technical User
Jul 11, 2005
3
US
I am trying to run 3 sites on my Linux server, with kernel 2.4.20 and apache 2.0.40. My httpd.conf is:

NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "/home/site1"
ServerName ServerAlias site1.cl *.site1.cl
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/home/site2"
ServerName ServerAlias site2.cl *.site2.cl
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/home/site3"
ServerName ServerAlias site3.com *.site3.com
</VirtualHost>

Only site3.com works, while both site1.cl and site2.cl show apache's test page. When I try to display specific html pages that I know are in the server, the response is "Forbidden You don't have permission to access xxx on this server. Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request."

When I do httpd -t -D DUMP_VHOSTS I see all 3 sites on port 80 apparently fine, with default the first one.

I have tried all kind of things I have found w/o success, this is the best combination I have, with one running. The only difference I see is that both ".cl" sites fail while ".com" works. But all 3 sites use the same DNS server and the test page might mean that the sites are reachable. I also check the permissions for the folders and they are similar among them.

Any ideas?
Thanks a lot,
Dani Guzman
 
Make sure "UseCanonicalName" is set to off and uncomment or add this: NameVirtualHost *:80

 
Thanks RythmAce. Both lines are set as you suggested in my conf, but still not working. What else can it be?
 
The test page means that the addresses are resolving to your server. The problem is that apache isn't finding the vhosts. If your vhost setup was working, then the first one defined would be the default. Since that doesn't seem to be working either, I'm going to guess that it is defaulting to the "main" server and not seeing the vhosts at all. One cause for this would be if the ServerName directive in the main section was pointing to site3.com. Take a look at your error logs. You may find exactly whats causing the problem in there. Don't forget to restart apache every time you change httpd.conf.

apachectl restart

once your server becomes active, you may want to start using "graceful" instead of restart so you don't knock every one off line.
 
I just though of this. Is there any chance that the directories are not readable by apache? You might want to check the permissions on the ones that aren't working.
 
Thanks RhythmAce! it was the permissions. Somehow they were different, I thought I had them right but I had not. Now the 3 sites are working fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top