Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora 17/18 > Servers & Networking
FedoraForum Search

Forgot Password? Join Us!

Servers & Networking Discuss any Fedora server problems and Networking issues such as dhcp, IP numbers, wlan, modems, etc.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 13th January 2008, 05:26 AM
onastvar Offline
Registered User
 
Join Date: Dec 2007
Posts: 10
Smile Apache (VirtualHost) with my own DNS server

I wasn't able to find any documentation or posts about setting name-based hosting (VirtualHost) I'm not using ISPCONFIG or WEBMIN. I would like to configure this manually.

This is my entry in httpd.conf (actual domain is replaced by domain.com) it is not working when I go to the actual URL. I've updated nameservers on my domain name with my own DNS.

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot /www/domain.com
ServerName www.domain.com
ServerAlias domain.com *.domain.com
</VirtualHost>

I'm not sure if i also have to add/edit named.conf since I'm running my own DNS. All the ports are open. I might not have included all the details but would appreciate any suggestions.


Thank You
Reply With Quote
  #2  
Old 14th January 2008, 02:44 PM
landoncz's Avatar
landoncz Offline
Registered User
 
Join Date: Dec 2005
Location: Florida, USA
Age: 34
Posts: 338
First you should check to be sure that the name you type in the URL actually resolves to your server, if it doesn't that means Apache will never get the request, so you should fix that first. You can do that by trying to ping the domain name of your virtual host, if it resolves, then your DNS is correct, and you can move on to Apache.

It looks like your Apache is setup correctly, but if it still doesn't work, you can check the access_log and error_log in /var/log/httpd for messages about what it thinks it is supposed to be doing...
__________________
Fedora Core 6 on Asus Z63A 14" Laptop
2.0 Ghz Pentium M
1 Gig RAM
100 Gig 7200 RPM

Code:
# rm -rf /dev/brain
Reply With Quote
  #3  
Old 14th January 2008, 04:58 PM
A.Serbinski Offline
Registered User
 
Join Date: Jul 2006
Posts: 1,123
Apache isn't interested in DNS or named.conf. Virtual hosting works using the HTTP request headers. Specifically, it tries to make a match against the "Host:" header. The HTTP headers are generated by the client and forwarded to the IP address derived from the hostname.

1) make sure that DNS resolution works correctly from the client machine.
2) check that the client is sending a request to the correct server (try using wireshark for this).
3) check that the HTTP header generated by the client has a matching Host header (again, wireshark).
4) check if the server is actually responding (more wireshark).
5) go through the apache logs to see whats happening.
Reply With Quote
  #4  
Old 14th January 2008, 05:00 PM
Matheny151 Offline
Registered User
 
Join Date: Jan 2008
Location: Winder Georgia
Posts: 2
what is wireshark?
Reply With Quote
  #5  
Old 14th January 2008, 05:10 PM
landoncz's Avatar
landoncz Offline
Registered User
 
Join Date: Dec 2005
Location: Florida, USA
Age: 34
Posts: 338
Quote:
Originally Posted by Matheny151
what is wireshark?
used to be Ethereal... An extremely useful packet analyzing program...
__________________
Fedora Core 6 on Asus Z63A 14" Laptop
2.0 Ghz Pentium M
1 Gig RAM
100 Gig 7200 RPM

Code:
# rm -rf /dev/brain
Reply With Quote
  #6  
Old 15th January 2008, 07:09 AM
onastvar Offline
Registered User
 
Join Date: Dec 2007
Posts: 10
Smile

Thank you landoncz and A.Serbinski !

I was able to setup VirtualHost in httpd and I can only view the original site (and 2nd site) from the server. When I go to another PC I can't see the 2nd site (domain.com) it looks like my DNS does not resolve the name. I think my DNS (named.conf) is not setup correctly. I could ping domain.com from my server but not from another machine.

entry for domain.com my named.conf
***************************************
zone "domain.com" IN {
type master;
file "domain.com.zone";
***************************************

Would you be able to assist or advise what should my zone file "domain.com.zone" have in order to reslove to domain.com

here is my "domain.com.zone" file
************************************************** **************************
$TTL 900
@ IN SOA domain.com.com (
postmaster
2007122100 ; Serial ID in reverse date format
21600 ; Refresh interval for slave servers
1800 ; Retry interval for slave servers
604800 ; Expire limit for cached info on slave servers
900 ) ; Minimum Cache TTL in zone records

@ NS domain.com.
@ NS ns.mynameserver.com.

@ A nnn.nnn.nnn.nnn ; my static ip address

@ MX 10 mail

mail A nnn.nnn.nnn.nnn ; my static ip address

www A nnn.nnn.nnn.nnn ; my static ip address

domain.com A nnn.nnn.nnn.nnn ; my static ip address

localhost A 127.0.0.1
************************************************** ***********************
Thanks for your help, I'm pretty new to this stuff, and I would appreciate any replies.
Reply With Quote
  #7  
Old 15th January 2008, 03:27 PM
A.Serbinski Offline
Registered User
 
Join Date: Jul 2006
Posts: 1,123
Its been a little while since I've worked on DNS, but I'll take a stab at it...

1) You don't show it in your above message, but you DO have the closing "};" for the entry in named.conf, right?

2) @ IN SOA <primary-name-server> <hostmaster-email> (

3) @ IN A nnn... <--- get rid of it, this would give you "http://domain.com.domain.com"

4) @ IN MX 10 mail <--- lose the "@", this would give you "abc@domain.com.domain.com --> nnn...." lose the "@"

5) mail IN A nnn.....

6) www IN A nnn...

7) domain.com IN A nnn.... <--- again, lose it. "domain.com.domain.com"

8) localhost ... <--- totally inappropriate. Assuming that this would even "take", this would tell every client that "localhost.domain.com = 127.0.0.1".


Code:
$TTL 900
@ IN SOA domain.com. (
2007122100 ; Serial ID in reverse date format
21600 ; Refresh interval for slave servers
1800 ; Retry interval for slave servers
604800 ; Expire limit for cached info on slave servers
900 ) ; Minimum Cache TTL in zone records

@ IN NS domain.com.
@ IN NS ns.mynameserver.com.
IN A nnn.nnn.nnn.nnn ; my static ip address
IN MX 10 mail
mail IN A nnn.nnn.nnn.nnn ; my static ip address
www IN A nnn.nnn.nnn.nnn ; my static ip address

Last edited by A.Serbinski; 15th January 2008 at 04:17 PM.
Reply With Quote
  #8  
Old 15th January 2008, 04:11 PM
onastvar Offline
Registered User
 
Join Date: Dec 2007
Posts: 10
Thank You A.Serbinski! I'll give it a try!
Reply With Quote
  #9  
Old 17th January 2008, 07:06 AM
onastvar Offline
Registered User
 
Join Date: Dec 2007
Posts: 10
Unhappy

I can't seem to configure second domain (domain-two.com) using VirtualHost. If anyone could take a peek at my files below and see if there is a problem I would appreciate. BTW, my domain-one.com is working fine.

my httpd.conf
(domain-one.com is my server name, domain-two.com is the 2nd domain i would like to host)
************************************************** *************************************************
<VirtualHost nnn.nnn.nnn.nnn:80>
ServerAdmin webmaster@domain-one.com
DocumentRoot /var/www/html
ServerName domain-one.com
</VirtualHost>

<VirtualHost nnn.nnn.nnn.nnn:80>
ServerAdmin webmaster@domain-two.com
DocumentRoot /home/domain-two/www
ServerName domain-two.com
ServerAlias domain-two.com * domain-two.com
</VirtualHost>
************************************************** ************
my named.conf
************************************************** ************
zone "domain-one.com" IN {
type master;
file "domain-one.com.zone";
};

zone "domain-two.com" IN {
type master;
file "domain-two.com.zone";
};
************************************************** ************
my domain-two.com.zone
************************************************** ************************************
$TTL 43200
@ IN SOA ns1.domain-one.com. hostmaster.ns1.domain-one.com. (
2008011500 ; serial
1H ; refresh
15M ; retry
14D ; expire
12H ; default_ttl
)

virtual IN A nnn.nnn.nnn.nnn
www IN CNAME virtual
ftp IN CNAME virtual
mail IN CNAME virtual
@ IN MX 5 virtual
@ IN NS ns1.domain-one.com
@ IN A nnn.nnn.nnn.nnn
************************************************** ************

Thank You
Reply With Quote
  #10  
Old 17th January 2008, 03:07 PM
A.Serbinski Offline
Registered User
 
Join Date: Jul 2006
Posts: 1,123
Again.... DNS has NOTHING TO DO with Apache. You need to troubleshoot them SEPARATELY. If you want to test your Apache configuration with DNS untested, you can use one of the following methods; Wget or Firefox+"Modify Headers Plugin" can allow you to modify the "Host:" header you're sending to the server (ie, http://ip.address with header modified to the domain name), or you can set the client's /etc/hosts temporarily to resolve the domain name to the correct IP address. Then test Apache.

1) Verify that the client is contacting the server.
2) Verify that the client is sending the expected request to the server.
3) Check Apache's logs.
Reply With Quote
Reply

Tags
apache, dns, server, virtualhost

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache F10 and the VirtualHost directive kovshenin Using Fedora 11 8th December 2008 11:45 PM
Apache VirtualHost - http://www. problem gooddesi Servers & Networking 4 30th April 2007 03:55 AM
virtualhost + cgi in apache ?? blackwoodie Servers & Networking 0 22nd November 2006 06:51 PM
apache: subdomain for all my domains using virtualhost? evasion81 Servers & Networking 1 2nd July 2005 05:00 AM


Current GMT-time: 17:57 (Wednesday, 19-06-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat