LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 12-22-2012, 11:27 AM   #1
psoheil
LQ Newbie
 
Registered: Mar 2010
Location: Chicago
Distribution: Redhat, CentOS, Ubuntu, Fedora
Posts: 22

Rep: Reputation: 0
Unhappy Apache Virtual Host Issue


Hello All,

I have a small dedicated server at home which runs Apache/2.2.22 on Fedora Linux 16 with Webmin. I have setup 3 Virtual Hosts using Webmin, which produces the following configuration in /etc/httpd/conf/httpd.conf

Code:
<VirtualHost *:80>
DocumentRoot /home/domain1.sytes.net/www/
ServerName domain1.sytes.net
<Directory "/home/domain1.sytes.net/www/">
allow from all
Options +Indexes
</Directory>
ServerAlias www.domain1.sytes.net
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /home/domain2.sytes.net/www/
ServerName domain2.sytes.net
<Directory "/home/domain2.sytes.net/www/">
allow from all
Options +Indexes
</Directory>
ServerAlias www.domain2.sytes.net
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /home/domain3.sytes.net/www/
ServerName domain3.sytes.net
<Directory "/home/domain3.sytes.net/www/">
allow from all
Options +Indexes
</Directory>
ServerAlias www.domain3.sytes.net
</VirtualHost>
For some reason the first 2 virtual hosts are working fine, but the third one I just added is not working and redirects traffic to the default apache server page. Does anyone have any suggestions as to why the 3rd host may not be working? The settings are identical to one another and I restarted apache several times without any luck.

Thanks,
Pete
 
Old 12-22-2012, 01:12 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

What is the output of:
Code:
apachectl -S
 
Old 12-22-2012, 01:35 PM   #3
psoheil
LQ Newbie
 
Registered: Mar 2010
Location: Chicago
Distribution: Redhat, CentOS, Ubuntu, Fedora
Posts: 22

Original Poster
Rep: Reputation: 0
Here is the response to that command:

Quote:
httpd: Could not reliably determine the server's fully qualified domain name, using fe80::213:72ff:fe0d:2760 for ServerName
[Sat Dec 22 13:26:55 2012] [warn] NameVirtualHost XXX.YYY.ZZZ.KKK:0 has no VirtualHosts
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80 is a NameVirtualHost
default server domain1.sytes.net (/etc/httpd/conf/httpd.conf:1009)
port 80 namevhost domain1.sytes.net (/etc/httpd/conf/httpd.conf:1009)
port 80 namevhost domain2.sytes.net (/etc/httpd/conf/httpd.conf:1018)
port 80 namevhost domain3.sytes.net (/etc/httpd/conf/httpd.conf:1027)
Syntax OK
I am using NO-IP.com Dynamic DNS Service to point to my home Server. The first two do resolve fine with the existing configuration, just not domain3.sytes.net.

Pete
 
Old 12-22-2012, 03:47 PM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
From the output looks like your vhosts are ok.
Quote:
I am using NO-IP.com Dynamic DNS Service to point to my home Server. The first two do resolve fine with the existing configuration, just not domain3.sytes.net.
I don't know how NO-IP can assign the same dynamic IP to more than one hostnames, but maybe you have a typo in NO-IP configuration, so your IP does not actually resolve to domain3.sytes.net
 
Old 12-22-2012, 06:06 PM   #5
psoheil
LQ Newbie
 
Registered: Mar 2010
Location: Chicago
Distribution: Redhat, CentOS, Ubuntu, Fedora
Posts: 22

Original Poster
Rep: Reputation: 0
I double checked the host name, and verified that domain3.sytes.net does resolve to the correct IP and makes it as far as my server. So the problem must be on my server! I just don't see it somehow.

Pete
 
Old 12-23-2012, 01:29 AM   #6
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,627

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
no-ip is good

a wilde guess is that your issue is on that side
recheck your no-ip.com set up

now on the other hand with all three on port 80 ?????
that could cause some " fun"

putting the third on 8080 might do it
 
Old 12-23-2012, 02:21 AM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by psoheil View Post
I double checked the host name, and verified that domain3.sytes.net does resolve to the correct IP and makes it as far as my server. So the problem must be on my server! I just don't see it somehow.

Pete
If the hostname resolves to your IP and apache has a vhost with that ServerName, then you should see that instead of the default. That's why we think there is a discrepancy between the No-IP hostname and the vhost ServerName.

BTW to get rid of:
Quote:
[Sat Dec 22 13:26:55 2012] [warn] NameVirtualHost XXX.YYY.ZZZ.KKK:0 has no VirtualHosts
search httpd.conf (and perhaps the included apache config files) for a second "NameVirtualHost .." definition and delete it. According to your vhosts configuration there should be only a "NameVirtualHost *:80" directive.
 
Old 12-23-2012, 10:11 AM   #8
psoheil
LQ Newbie
 
Registered: Mar 2010
Location: Chicago
Distribution: Redhat, CentOS, Ubuntu, Fedora
Posts: 22

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by bathory View Post
If the hostname resolves to your IP and apache has a vhost with that ServerName, then you should see that instead of the default. That's why we think there is a discrepancy between the No-IP hostname and the vhost ServerName.
I tipple checked the no-ip setting and it is resolving to my server fine. There really isn't a whole lot of settings on the no-ip end, and I re-checked the few there is and confirmed there is no difference between the settings of the 3 sub domains. I also re-checked and made sure there is no difference between the way the sub domains are entered into no-ip and the way I have them in my configuration file. I even double checked the file system permission of the folder where domain3 is pointing and it has the identical file system permission as the others. It makes no sense! I am open to any other suggestions anyone may have in this regard.

Quote:
Originally Posted by bathory View Post
BTW to get rid of:
search httpd.conf (and perhaps the included apache config files) for a second "NameVirtualHost .." definition and delete it. According to your vhosts configuration there should be only a "NameVirtualHost *:80" directive.
I did find a second IP Specific NameVirtualHost entry and commented it out, which got rid of the warning:

Quote:
httpd: Could not reliably determine the server's fully qualified domain name, using fe80::213:72ff:fe0d:2760 for ServerName
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80 is a NameVirtualHost
default server domain1.sytes.net (/etc/httpd/conf/httpd.conf:1009)
port 80 namevhost domain1.sytes.net (/etc/httpd/conf/httpd.conf:1009)
port 80 namevhost domain2.sytes.net (/etc/httpd/conf/httpd.conf:1018)
port 80 namevhost domain3.sytes.net (/etc/httpd/conf/httpd.conf:1027)
Syntax OK
I also don't see any relevant error messages in the error_log or access_log.

By the way, the Default Server has the following configuration:

Address: Any
Port: Any
Server Name: Automatic
Document Root: /var/www/html

Would that effect the settings for domain3 in any way?

Thanks,
Pete

Last edited by psoheil; 12-23-2012 at 10:34 AM.
 
Old 12-23-2012, 11:28 AM   #9
tquang
Member
 
Registered: Jul 2010
Posts: 44

Rep: Reputation: 0
Re-check port listen in httpd.conf
Code:
Listen 80
Add above and restart it
Code:
NameVirtualHost *:80
In Apache 2.4 directive NameVirtualHost no need because Apache's development had removed it.

Code:
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /home/domain1.sytes.net/www/
ServerName domain1.sytes.net
<Directory "/home/domain1.sytes.net/www/">
allow from all
Options +Indexes
</Directory>
ServerAlias www.domain1.sytes.net
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /home/domain2.sytes.net/www/
ServerName domain2.sytes.net
<Directory "/home/domain2.sytes.net/www/">
allow from all
Options +Indexes
</Directory>
ServerAlias www.domain2.sytes.net
</VirtualHost>

<VirtualHost *:80>
DocumentRoot /home/domain3.sytes.net/www/
ServerName domain3.sytes.net
<Directory "/home/domain3.sytes.net/www/">
allow from all
Options +Indexes
</Directory>
ServerAlias www.domain3.sytes.net
</VirtualHost>
 
Old 12-23-2012, 12:29 PM   #10
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
By the way, the Default Server has the following configuration:

Address: Any
Port: Any
Server Name: Automatic
Document Root: /var/www/html

Would that effect the settings for domain3 in any way?
Dunno how webmin works, but since the other 2 vhost work, it shouldn't matter.
What happens if you manually move the 3rd vhost stanza before the 1st one in httpd.conf, so it becomes the default vhost?
 
Old 12-23-2012, 02:44 PM   #11
psoheil
LQ Newbie
 
Registered: Mar 2010
Location: Chicago
Distribution: Redhat, CentOS, Ubuntu, Fedora
Posts: 22

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by tquang View Post
Re-check port listen in httpd.conf
Code:
Listen 80
Add above and restart it
Code:
NameVirtualHost *:80
In Apache 2.4 directive NameVirtualHost no need because Apache's development had removed it.
I already had "Listen 80" in my config file, and removing NameVirtualHost directive not only didn't help but it broke the other two domains, and generated the following two errors on restart of apache:

Code:
[Sun Dec 23 14:23:52 2012] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
[Sun Dec 23 14:23:52 2012] [warn] _default_ VirtualHost overlap on port 80, the first has precedence
As far as the other suggestion:

Quote:
Originally Posted by bathory View Post
Dunno how webmin works, but since the other 2 vhost work, it shouldn't matter.
What happens if you manually move the 3rd vhost stanza before the 1st one in httpd.conf, so it becomes the default vhost?
I moved the 3rd vhost up to the beginning and restarted apache, but it made no difference.

I am posting my complete httpd.conf file here as an attachment in hope that someone can point out what the actual problem may be.

httpd_conf.txt

Thanks,
Pete
 
Old 12-24-2012, 02:43 AM   #12
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
I'm baffled. Your config looks ok, so I cannot tell what the problem really is.
I still suspect some typo in the vhost definition, as the hostname resolves correctly to your apache IP, but apache does not know that vhost name, so it gives the default server.
Have you tried to use both domain3.sytes.net and www.domain3.sytes.net?
Also try to use telnet and see what you get:
Code:
telnet x.x.x.x 80
GET / HTTP/1.1
host: domain3.sytes.net 
<Enter>
<Emter>
 
Old 12-24-2012, 07:24 AM   #13
psoheil
LQ Newbie
 
Registered: Mar 2010
Location: Chicago
Distribution: Redhat, CentOS, Ubuntu, Fedora
Posts: 22

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by bathory View Post
I'm baffled. Your config looks ok, so I cannot tell what the problem really is.
I still suspect some typo in the vhost definition, as the hostname resolves correctly to your apache IP, but apache does not know that vhost name, so it gives the default server.
Have you tried to use both domain3.sytes.net and www.domain3.sytes.net?
Also try to use telnet and see what you get:
Code:
telnet x.x.x.x 80
GET / HTTP/1.1
host: domain3.sytes.net 
<Enter>
<Emter>
The www.domain3.sytes.net doesn't resolve at all (brings up a blank page). Only domain3.sytes.net goes to the test page of apache.

I tried and telnet to the server from another machine and still got the html of the apache test page.

Pete
 
Old 12-24-2012, 08:39 AM   #14
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
The www.domain3.sytes.net doesn't resolve at all (brings up a blank page)
That means it resolves to some ip, otherwise you should get an error. Use
Code:
nslookup www.domain3.sytes.net
to see where it resolves.


Quote:
Only domain3.sytes.net goes to the test page of apache.
What happens if you replace the default "/var/www/html" in DocumentRoot with "/home/domain3.sytes.net/www"?
 
Old 12-24-2012, 01:12 PM   #15
psoheil
LQ Newbie
 
Registered: Mar 2010
Location: Chicago
Distribution: Redhat, CentOS, Ubuntu, Fedora
Posts: 22

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by bathory View Post
That means it resolves to some ip, otherwise you should get an error. Use
Code:
nslookup www.domain3.sytes.net
to see where it resolves.
Here is what I get for "www.domain3.sytes.net":

Quote:
Server: XXXXX.comcast.net
Address: XX.XX.XX.XX (not my IP)

*** XXXXX.comcast.net can't find www.domain3.sytes.net: Non-existent domain
I get this response for both my other domains too though, so I don't think that's the problem.

Quote:
Originally Posted by bathory View Post
What happens if you replace the default "/home" in DocumentRoot with "/home/domain3.sytes.net/www"?
I still get the apache test page for domain3. I even tried adding a 4th domain "domain4.no-ip.info" and the 4th domain shows the same apache test page, even though everything is correct! I have to admit this is one of the strangest problems I have had in my 20 years of work!

Pete
 
  


Reply

Tags
apache, httpdconf, virtual host, webmin



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
Any way to tunnel apache virtual host to an internal apache? ciuly Linux - Server 5 01-31-2010 12:53 PM
Apache Virtual Host issue ciphyre Linux - Server 3 10-24-2008 11:29 AM
Apache: virtual host issue Zeno McDohl Linux - Server 17 12-21-2006 02:59 PM
Virtual Host issue with apache gauge73 Linux - Networking 1 07-12-2005 02:00 PM
Apache Virtual Host problem - DNS or DHCP issue? costrevs Linux - Software 16 03-23-2005 07:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:26 PM.

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
Open Source Consulting | Domain Registration