LinuxQuestions.org
Help answer threads with 0 replies.
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 01-10-2011, 04:52 PM   #1
krazynotez
LQ Newbie
 
Registered: Jan 2011
Posts: 2

Rep: Reputation: 0
Name based virtual hosting not working


I've been trying to get my name-based server to work for a week now. I've read about everything there is and double checked my configs, but when I go to any of my sites, it always goes to the first virtual host.

Here is my Webmin system info -
Quote:
System hostname localhost.localdomain
Operating system Redhat Linux Fedora 11
Webmin version 1.530
Time on system Mon Jan 10 15:36:23 2011
Kernel and CPU Linux 2.6.30.10-105.2.23.fc11.x86_64 on x86_64
Processor information AMD Athlon(tm) II X2 245 Processor, 2 cores
System uptime 2 hours, 18 minutes
Running processes 146
CPU load averages 0.00 (1 min) 0.00 (5 mins) 0.00 (15 mins)
CPU usage 6% user, 4% kernel, 0% IO, 89% idle
Real memory 1.70 GB total, 446.65 MB used

Virtual memory 3.41 GB total, 0 bytes used

Local disk space 455.09 GB total, 37.82 GB used

Package updates All installed packages are up to date
Here is the end of my httpd.conf file:

Code:
NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /var/www/html/musicon11
ServerName musicon11.com
<Directory "/var/www/html/musicon11">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/html/35x40
ServerName 35x40productions.com
<Directory "/var/www/html/35x40">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/html/oin
ServerName oklahomaindienow.com
<Directory "/var/www/html/oin">
allow from all
Options +Indexes
</Directory>
</VirtualHost>
Your help is appreciated!
 
Old 01-10-2011, 05:27 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,217
Blog Entries: 1

Rep: Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070
Hi,

You should check you dns settings
Code:
host musicon11.com
host 35x40productions.com
host oklahomaindienow.com
From here the last 2 domains resolve to the same IP, while the 1st to a different one
 
Old 01-10-2011, 08:27 PM   #3
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,196

Rep: Reputation: 1044Reputation: 1044Reputation: 1044Reputation: 1044Reputation: 1044Reputation: 1044Reputation: 1044Reputation: 1044
It doesn't matter that all names resolve to the same IP. After all that is what you want with name-based VH, all sites resolve to the same server and let the server figure out what Virtual Domain has to be served from the name.

The problem is that you specify servername yourdomain.com but this will not match www.youdomain.com. To achieve that, you need an additional statement:
serveralias yourdomain.com *.yourdomain.com
in the stanza between
<virtualhost>
...
serveralias yourdomain.com *.yourdomain.com
...
...
</virtualhost>

jlinkels
 
Old 01-11-2011, 12:11 PM   #4
krazynotez
LQ Newbie
 
Registered: Jan 2011
Posts: 2

Original Poster
Rep: Reputation: 0
Still not working

Thank you for your prompt responses.

I tried bathory's solution to no avail. I started to look through my DNS listings and how my pointing services worked and I think I might be on to something. here is my dig info I am going over.

Code:
dig musicon11.com

; <<>> DiG 9.6.2-P2-RedHat-9.6.2-4.P2.fc11 <<>> musicon11.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 42472
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 3

;; QUESTION SECTION:
;musicon11.com.			IN	A

;; ANSWER SECTION:
musicon11.com.		300	IN	A	68.99.70.130

;; AUTHORITY SECTION:
musicon11.com.		167579	IN	NS	ns3.mdnsservice.com.
musicon11.com.		167579	IN	NS	ns1.mdnsservice.com.
musicon11.com.		167579	IN	NS	ns2.mdnsservice.com.

;; ADDITIONAL SECTION:
ns1.mdnsservice.com.	168	IN	A	216.40.47.18
ns2.mdnsservice.com.	168	IN	A	64.98.148.11
ns3.mdnsservice.com.	168	IN	A	65.22.7.10

;; Query time: 54 msec
;; SERVER: 68.105.28.16#53(68.105.28.16)
;; WHEN: Tue Jan 11 10:50:39 2011
;; MSG SIZE  rcvd: 161

> dig oklahomaindienowcom

; <<>> DiG 9.6.2-P2-RedHat-9.6.2-4.P2.fc11 <<>> oklahomaindienowcom
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 14881
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;oklahomaindienowcom.		IN	A

;; AUTHORITY SECTION:
.			900	IN	SOA	a.root-servers.net. nstld.verisign-grs.com. 2011011001 1800 900 604800 86400

;; Query time: 60 msec
;; SERVER: 68.105.28.16#53(68.105.28.16)
;; WHEN: Tue Jan 11 10:50:51 2011
;; MSG SIZE  rcvd: 112

> dig 35x40productions.com

; <<>> DiG 9.6.2-P2-RedHat-9.6.2-4.P2.fc11 <<>> 35x40productions.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 60776
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2

;; QUESTION SECTION:
;35x40productions.com.		IN	A

;; ANSWER SECTION:
35x40productions.com.	716	IN	A	65.254.248.143

;; AUTHORITY SECTION:
35x40productions.com.	169916	IN	NS	ns1.fatcow.com.
35x40productions.com.	169916	IN	NS	ns2.fatcow.com.

;; ADDITIONAL SECTION:
ns1.fatcow.com.		3291	IN	A	65.254.254.100
ns2.fatcow.com.		1515	IN	A	65.254.254.101

;; Query time: 11 msec
;; SERVER: 68.105.28.16#53(68.105.28.16)
;; WHEN: Tue Jan 11 10:51:09 2011
;; MSG SIZE  rcvd: 129

> dig 68.99.70.130

; <<>> DiG 9.6.2-P2-RedHat-9.6.2-4.P2.fc11 <<>> 68.99.70.130
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 42254
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;68.99.70.130.			IN	A

;; AUTHORITY SECTION:
.			900	IN	SOA	a.root-servers.net. nstld.verisign-grs.com. 2011011001 1800 900 604800 86400

;; Query time: 51 msec
;; SERVER: 68.105.28.16#53(68.105.28.16)
;; WHEN: Tue Jan 11 10:51:33 2011
;; MSG SIZE  rcvd: 105

> dig oklahomaindienow.com

; <<>> DiG 9.6.2-P2-RedHat-9.6.2-4.P2.fc11 <<>> oklahomaindienow.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47098
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2

;; QUESTION SECTION:
;oklahomaindienow.com.		IN	A

;; ANSWER SECTION:
oklahomaindienow.com.	3600	IN	A	65.254.248.143

;; AUTHORITY SECTION:
oklahomaindienow.com.	172800	IN	NS	ns1.fatcow.com.
oklahomaindienow.com.	172800	IN	NS	ns2.fatcow.com.

;; ADDITIONAL SECTION:
ns1.fatcow.com.		3163	IN	A	65.254.254.100
ns2.fatcow.com.		1387	IN	A	65.254.254.101

;; Query time: 207 msec
;; SERVER: 68.105.28.16#53(68.105.28.16)
;; WHEN: Tue Jan 11 10:53:16 2011
;; MSG SIZE  rcvd: 129

> dig 65.254.248.143

; <<>> DiG 9.6.2-P2-RedHat-9.6.2-4.P2.fc11 <<>> 65.254.248.143
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 54197
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;65.254.248.143.			IN	A

;; AUTHORITY SECTION:
.			900	IN	SOA	a.root-servers.net. nstld.verisign-grs.com. 2011011001 1800 900 604800 86400

;; Query time: 55 msec
;; SERVER: 68.105.28.16#53(68.105.28.16)
;; WHEN: Tue Jan 11 10:54:05 2011
;; MSG SIZE  rcvd: 107
here is my current httpd file (just the vhosts part)
Code:
#NameVirtualHost 68.99.70.130:80
NameVirtualHost *:80
ServerName 35x40productions

<VirtualHost *:80>
DocumentRoot "/var/www/html/musicon11"
ServerName musicon11.com
ServerAlias musicon11.com *.musicon11.com*
<Directory "/var/www/html/musicon11">
allow from all
Options +Indexes
</Directory>
</VirtualHost>

<VirtualHost *:80>
DocumentRoot "/var/www/html/35x40"
ServerName 35x40productions.com
ServerAlias 35x40productions.com *.35x40productions.com*
<Directory "/var/www/html/35x40">
allow from all
Options +Indexes
</Directory>
</VirtualHost>

I'm going to keep working on it. Any guidance or suggestions would be appreciated.
 
Old 01-11-2011, 01:00 PM   #5
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,217
Blog Entries: 1

Rep: Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070
Hi,

It's not going to work as long as long as musicon11.com and 35x40productions.com resolve to 2 different IP addresses.
Are you sure you mean Name virtual hosts and not IP-based virtual hosts. If your webserver listens on both IPs and you want to setup a vhost per IP, you need IP-based vhosts. Take a look at apache documentation to see the difference and the needed configuration for each case.

Regards
 
Old 01-11-2011, 03:29 PM   #6
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,196

Rep: Reputation: 1044Reputation: 1044Reputation: 1044Reputation: 1044Reputation: 1044Reputation: 1044Reputation: 1044Reputation: 1044
@bathory: why is it not allowed to resolve the two domains to different IP addresses? Since no IP address is specified in the config file, Apache should not care about IP address. I have one server set up which is accessed thru different IP addresses and ports but using only the VH config just like krazynotez does it.

Whatever, it is recommended to use the httpd -S option during start of Apache to get information about how Apache parses the config file.

jlinkels
 
Old 01-11-2011, 04:23 PM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,217
Blog Entries: 1

Rep: Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070Reputation: 2070
@jlinkels
Quote:
@bathory: why is it not allowed to resolve the two domains to different IP addresses? Since no IP address is specified in the config file, Apache should not care about IP address. I have one server set up which is accessed thru different IP addresses and ports but using only the VH config just like krazynotez does it.
I didn't say that. I said that with different IPs the Named-based vhosts are not going to work, so OP needs to use IP-based vhosts.
I guess your setup works because you're using different IPs and ports.

Regards
 
  


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
IP based Virtual Hosting sandeepthug Linux - Server 2 04-15-2010 07:30 AM
virtual name based hosting atomicrm Linux - Server 8 12-17-2009 10:20 AM
name based virtual hosting with two ips nephish Linux - Server 3 07-05-2007 08:29 AM
name based virtual hosting jkmartha Linux - Software 4 08-04-2005 10:21 AM
name based virtual hosting adm1329 Linux - Networking 5 05-05-2004 12:30 PM

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

All times are GMT -5. The time now is 09:48 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