[CentOS] Apache: confusion about virtual hosts and DNS on a local network

Niki Kovacs

contact at kikinovak.net
Sat Sep 19 12:21:16 UTC 2009


Hi,

I set up a webserver with Apache on one of the machines on the local 
network. There's a DNS configured for the LAN, with a dummy domain name 
(presbytere.local), and every machine is pingable by its hostname. The 
webserver runs on the machine 'buildbox'.

The webserver actually has two (static) websites on it, for testing and 
fiddling purposes. Each site's pages are stored respectively under 
/var/www/html/microlinux and /var/www/html/kikinovak. I can reach the 
two websites from any machine on the local network by opening a web 
browser at http://buildbox/microlinux/ or 
http://buildbox.presbytere.local/microlinux/ for the first website, and 
http://buildbox/kikinovak resp. 
http://buildbox.presbytere.local/kikinovak for the second website. So 
far so good.

Now I'd like to setup two virtual hosts on the server, so I can access 
the first site via http://microlinux.buildbox and the second site via 
http://kikinovak.buildbox. I tried various combinations that seemed to 
make sense, but to no avail.

Here's what I *think* my /etc/httpd/conf/httpd.conf should look like:

NameVirtualHost *:80

<VirtualHost *:80>
  ServerAdmin info at microlinux.fr
  DocumentRoot /var/www/html/microlinux
  ServerName buildbox.presbytere.local
  ServerAlias microlinux.buildbox.presbytere.local
  ErrorLog logs/microlinux-error_log
  CustomLog logs/microlinux-access_log common
</VirtualHost>

But that doesn't work out (yes, I restarted httpd :oD), because I think 
what's missing here is that I have to somehow add microlinux.buildbox 
(and later kikinovak.buildbox) to my local DNS server (only how?)...

Here's my current Bind configuration for the local network:

First, /var/named/zone.local.presbytere:

;
; Zone DNS pour presbytere.local
;
$ORIGIN presbytere.local.
$TTL 1D
@     IN SOA   babasse hostmaster (
                         2009070201   ; serial
                         8H           ; refresh
                         4H           ; retry
                         4W           ; expire
                         1D )         ; minimum
; babasse.presbytere.local est le serveur de noms (NS) pour ce domaine
                 NS      babasse
; au cas où quelqu'un ferait une requête pour localhost.presbytere.local
localhost       A       127.0.0.1
; nos machines
babasse         A       192.168.1.1
buildbox        A       192.168.1.2
lifebook        A       192.168.1.3
raymonde        A       192.168.1.4
jukebox         A       192.168.1.5
frankenstein    A       192.168.1.6

ap              A       192.168.1.253
modem           A       192.168.1.254

And then, /var/named/revp.192.168.1:

;
; Résolution inverse pour le réseau 192.168.1.0
;
$ORIGIN 1.168.192.in-addr.arpa.
$TTL 1D
@     IN SOA  babasse.presbytere.local. contact.kikinovak.net. (
               2009070201  ; serial
               28800       ; refresh (8 hours)
               14400       ; retry (4 hours)
               2419200     ; expire (4 weeks)
               86400       ; minimum (1 day)
               )
; Définit le serveur de noms faisant autorité
               NS      babasse.presbytere.local.
; Nos machines
1             PTR     babasse.presbytere.local.
2             PTR     buildbox.presbytere.local.
3             PTR     lifebook.presbytere.local.
4             PTR     raymonde.presbytere.local.
5             PTR     jukebox.presbytere.local.
6             PTR     frankenstein.presbytere.local.

253           PTR     ap.presbytere.local.
254           PTR     modem.presbytere.local.

I admit I'm a bit confused, and I don't know if I succeeded in 
accurately describing my ignorance here.

Any suggestions?

Niki



More information about the CentOS mailing list