LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices



Reply
 
Search this Thread
Old 04-17-2008, 11:55 AM   #1
bg108
LQ Newbie
 
Registered: Nov 2007
Posts: 17

Rep: Reputation: 0
Apache2 VirtualHost Syntax OK but domain still doesn't work


Hi,

I'm trying to add another virtual host for my apache2 server (running on Gentoo Linux) and it doesn't work eventhough apache2ctl -S shows syntax OK....I have around 5 VirtualHost on my apache2 server and they are working fine, but when I try to add another virtualhost it doesn't work (browser says cannot display page)

Here is a part of my vhost config files

<VirtualHost *:80>
ServerName fgo.laolao.com
DocumentRoot "/home/webhost/bizware"
</VirtualHost>

<VirtualHost *:80>
ServerName logostore.laolao.com
DocumentRoot "/home/webhost/bizdata/logoStore"
</VirtualHost>

Above shows 2 virtual host configurations, the first one fgo.laolao.com is working, however the second one logostore.laolao.com doesn't work....


Please help,
THanks
 
Old 04-17-2008, 12:02 PM   #2
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , Solaris 10, RHEL
Posts: 1,935
Blog Entries: 1

Rep: Reputation: 188Reputation: 188
I may be wrong, but I think that using this twice might be the problem.

Code:
<VirtualHost *:80>
I have always put the IP address instead of the *

Like so

Code:
<VirtualHost 192.168.2.1:80>
Hope this helps

-C
 
Old 04-17-2008, 12:11 PM   #3
datopdog
Member
 
Registered: Feb 2008
Location: JHB South Africa
Distribution: Centos, Kubuntu, Cross LFS, OpenSolaris
Posts: 806

Rep: Reputation: 41
The "*:80" is not a problem is simply means that apache will respond to all the interfaces on the server for that vhost.

You need to setup an error and access log for the vhost and then take a look at what apache is logging.

I suspect 2 things could cause that.

1. The app running in the document root has errors
2. Apache cannot search the path due to permission settings being incorrect, for apache to be able to server content all the directores above need to have the -x bit set.
 
Old 04-17-2008, 12:23 PM   #4
bg108
LQ Newbie
 
Registered: Nov 2007
Posts: 17

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by datopdog View Post
The "*:80" is not a problem is simply means that apache will respond to all the interfaces on the server for that vhost.

You need to setup an error and access log for the vhost and then take a look at what apache is logging.

I suspect 2 things could cause that.

1. The app running in the document root has errors
2. Apache cannot search the path due to permission settings being incorrect, for apache to be able to server content all the directores above need to have the -x bit set.
1. The app running in the document root has NO errors because it's just a simple html file with HELLO output string
2. Permission to document root folder and above folders are fine, I can access document root folder by going though bizdata.laolao.com/logoStore but logostore.laolao.com doesn't work
 
Old 04-17-2008, 01:08 PM   #5
datopdog
Member
 
Registered: Feb 2008
Location: JHB South Africa
Distribution: Centos, Kubuntu, Cross LFS, OpenSolaris
Posts: 806

Rep: Reputation: 41
It will not hurt to turn on logging to see actually what is going on.

what is the output of
Code:
apache2 -D DUMP_VHOSTS
do you see the server with the correct root named there
 
Old 04-17-2008, 06:32 PM   #6
bg108
LQ Newbie
 
Registered: Nov 2007
Posts: 17

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by datopdog View Post
It will not hurt to turn on logging to see actually what is going on.

what is the output of
Code:
apache2 -D DUMP_VHOSTS
do you see the server with the correct root named there

I've already turned on the logging, but no error, like I said vhost configuration syntax is ok
 
Old 04-17-2008, 07:15 PM   #7
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Do you have a NameVirtualHost directive before these declarations?

Along the lines of what tatopgog was pushing, can you swap these two declartations around and confirm that it's the first that works not just fgo?

Last edited by billymayday; 04-17-2008 at 07:17 PM.
 
Old 04-17-2008, 08:20 PM   #8
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora, Lubuntu, FreeBSD
Posts: 3,930
Blog Entries: 5

Rep: Reputation: Disabled
Quote:
Originally Posted by billymayday
Do you have a NameVirtualHost directive before these declarations?
Bingo. Without it these are IP-based virtual hosts...
 
Old 04-18-2008, 11:23 AM   #9
bg108
LQ Newbie
 
Registered: Nov 2007
Posts: 17

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by anomie View Post
Bingo. Without it these are IP-based virtual hosts...
Yes, I put NameVirtualHost directive at the beginning of the file....here is my vhost config file


NameVirtualHost *:80
NameVirtualHost *:443

<Directory "/home/hosting">
AllowOverride None
Order allow,deny
Allow from all
</Directory>

<VirtualHost *:80>
ServerName fgo.laolao.com
DocumentRoot "/home/hosting/bbware"
</VirtualHost>

<VirtualHost *:80>
ServerName logostore.laolao.com
DocumentRoot "/home/hosting/bbdata/logoStore"
</VirtualHost>


Like I said, fgo.laolao.com is working but not logostore.laolao.com. Is there anything else that could make this happen ? I just started working at this company and this apache2 server was configured by previous Administrator, and I'm new to apache too. Is there some place else in Apache server that could explicitly define to allow DNS recognizing fgo.insightrix.com ?

Last edited by bg108; 04-18-2008 at 11:32 AM.
 
Old 04-18-2008, 12:12 PM   #10
bg108
LQ Newbie
 
Registered: Nov 2007
Posts: 17

Original Poster
Rep: Reputation: 0
Hi,

After doing searching around, I think my problem is I need to configure DNS server probably (Gentoo Linux). Could anyone show me steps by steps of how to configure DNS server ?
 
Old 04-18-2008, 01:26 PM   #11
billymayday
Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Maybe this will help http://www.linuxhomenetworking.com/w...onfiguring_DNS

Before you do that though, try adding fgo.laolao.com and logostore.laolao.com to the hosts file of whatever machine you are testing from to make sure that's the issue. No point going through all that setup to find it doesn't fix your problem.

Two simple lines should do it (don't deleted what's there already) - say the apache server's IP is 1.2.3.4

/etc/hosts

existing (something like)

127.0.0.1 localhost.localdomain localhost

plus new

1.2.3.4 fgo.laolao.com
1.2.3.4 logostore.laolao.com

Did you try reversing the entries for virtualhosts?
 
Old 04-18-2008, 01:54 PM   #12
bg108
LQ Newbie
 
Registered: Nov 2007
Posts: 17

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by billymayday View Post
Maybe this will help http://www.linuxhomenetworking.com/w...onfiguring_DNS

Before you do that though, try adding fgo.laolao.com and logostore.laolao.com to the hosts file of whatever machine you are testing from to make sure that's the issue. No point going through all that setup to find it doesn't fix your problem.

Two simple lines should do it (don't deleted what's there already) - say the apache server's IP is 1.2.3.4

/etc/hosts

existing (something like)

127.0.0.1 localhost.localdomain localhost

plus new

1.2.3.4 fgo.laolao.com
1.2.3.4 logostore.laolao.com

Did you try reversing the entries for virtualhosts?
Thanks very much guys, I finally got it working, I had to do something with DNS binding...Specifically I added an entry for "logostore" into the file host.zone under /var/bind

Thanks again
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache2 VirtualHost and SSL Alfar Linux - Server 2 10-20-2007 02:10 AM
setting up domain thru virtualhost on apache fiona333 Linux - Newbie 2 06-20-2007 06:27 PM
Using VirtualHost with single IP in Apache2 gurl4sh25 Linux - Server 2 05-06-2007 10:32 AM
Virtual host www.domain.com work, domain.com don't work stormrider_may Linux - Networking 4 05-03-2006 10:52 PM
Apache2 virtualHost config problem jglazner Linux - Software 3 04-01-2004 03:22 AM


All times are GMT -5. The time now is 12:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration