LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-10-2014, 11:27 AM   #1
James0806
Member
 
Registered: Jul 2014
Posts: 30

Rep: Reputation: Disabled
Error in virtual hosting with dns


Want to Host server.example.com,server.google.com
On the IP 192.168.0.10
NameVirtualHost 192.168.0.10 :80

httpd.conf configuration is as follows

<VirtualHost 192.168.0.10:80>
ServerAdmin webmaster@example.com
DocumentRoot /var/www/html
ServerName server.example.com
</VirtualHost>
<VirtualHost 192.168.0.10:80>
ServerAdmin webmaster@example.com
DocumentRoot /var/www/google
ServerName server.google.com
</VirtualHost>



Entry in the vim /etc/named.rfc1912.zones
is as follows
zone "example.com" IN {
type master;
file "for.zone";
allow-update { none; };
};
zone "google.com" IN {
type master;
file "google.for.zone";
allow-update { none; };
};

unable to load the page with server.google.com
says that the server is not found

Last edited by James0806; 08-10-2014 at 12:07 PM. Reason: Less response or for providing more info
 
Old 08-10-2014, 08:22 PM   #2
zer0python
Member
 
Registered: Sep 2003
Posts: 104

Rep: Reputation: 20
Not sure about the DNS stuff, but your apache config appears to be off.

Quote:
<VirtualHost 192.168.0.10:80>
ServerAdmin webmaster@example.com
DocumentRoot /var/www/html
ServerName server.example.com
</VirtualHost>
<VirtualHost 192.168.0.10:80>
ServerAdmin webmaster@example.com
DocumentRoot /var/www/google
ServerName server.google.com
</VirtualHost>
This tells Apache to setup a virtualhost 192.168.0.10:80 and respond with ServerName 'server.example.com' or 'server.google.com', What you want to do is setup a VirtualHost for server.example.com and server.google.com like so:

Code:
<VirtualHost server.example.com:80>
ServerAdmin webmaster@example.com
DocumentRoot /var/www/html
ServerName server.example.com
</VirtualHost>
<VirtualHost server.google.com:80>
ServerAdmin webmaster@example.com
DocumentRoot /var/www/google
ServerName server.google.com
</VirtualHost>
 
Old 08-11-2014, 01:35 AM   #3
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,516

Rep: Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501Reputation: 1501
Quote:
This tells Apache to setup a virtualhost 192.168.0.10:80 and respond with ServerName 'server.example.com' or 'server.google.com', What you want to do is setup a VirtualHost for server.example.com and server.google.com like so:

<VirtualHost server.example.com:80>
<snip>
<VirtualHost server.google.com:80>
<snip>
This is wrong. The notation used by OP is the corrent one.

@OP
Probably a dns problem. Do both server.example.com and server.google.com resolve to the IP of your webserver
 
Old 08-11-2014, 04:29 PM   #4
zer0python
Member
 
Registered: Sep 2003
Posts: 104

Rep: Reputation: 20
Quote:
This is wrong. The notation used by OP is the corrent one.
Actually, they're both valid; however, using FQDN's is apparently not recommended. link

So, I must recant my previous statement. (Thanks, bathory!)

As bathory noted, what do the IP's for those particular domains resolve to? (you can use host/nslookup/ping, whatever to find out.)

Stupid question, but is your host's /etc/resolv.conf configured to use your named server?
Do the apache logs give any hints?
have you seen what responds when you do:

Code:
echo -e "GET / HTTP/1.0\nHost: server.example.com\n" | nc 192.168.0.10 80
echo -e "GET / HTTP/1.0\nHost: server.google.com\n" | nc 192.168.0.10 80
 
  


Reply

Tags
dns changes, httpdconf


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
How to stop IP based hosting in virtual hosting deepak_message Linux - Server 7 08-19-2011 02:12 AM
Virtual Hosting dougreed Linux - Newbie 7 08-20-2009 12:59 PM
Virtual hosting elfoozo Red Hat 5 07-02-2009 10:02 AM
do I really need virtual hosting if only hosting one site kustomjs Linux - Server 8 05-22-2008 01:17 PM
Virtual Hosting - what does it actually do? gevers1 Linux - General 3 02-01-2004 10:28 AM


All times are GMT -5. The time now is 08:08 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration