Multiple Domains On Webserver - Local DNS?

Associate
Joined
1 May 2006
Posts
810
Location
Bristol, UK
Evening all,

I've got an Apache/PHP/MySQL server running and everything is fine. However I'm trying to setup virtual hosting and its not quite working right.

Reading various guides on the net it appears as though I require a DNS server to reslove the domains correctly. Is this the case?

I have no experience at all with DNS servers, I've downloaded BIND-LE but I'm totally lost. If anyone could advise me on how to get a DNS server running I'd greatly appreciate it.

Cheers.
 
Freakish_05 said:
Reading various guides on the net it appears as though I require a DNS server to reslove the domains correctly. Is this the case?

Depends what you mean by "resolve the domains correctly".
You don't need to be running a local DNS server for working virtual hosts, if that's what you're after.
 
Might help if I posted my virtual hosts config file lol, so here it is:
Code:
NameVirtualHost *:80

<virtualhost *:80>
    ServerName localhost
    DocumentRoot "C:/www/"
    ServerAlias 192.168.2.4
</virtualhost>
<virtualhost *:80>
    ServerName moshweb.co.uk
    DocumentRoot "C:/www/moshweb/"
    ServerAlias www.moshweb.co.uk
</virtualhost>
However, from other terminals within the network, 192.168.2.4 opens the index file in C:/www/moshweb/, www.moshweb.co.uk opens the index file in C:/www and moshweb.co.uk doesn't work at all.
I should probably mention that C:/www will contain a site that will only be accessible by local terminals and C:/www/moshweb will contain a site that should be accessible from the world wide web. There are plans to add extra public sites as well.
TIA
 
Swap the IP address for an actual domain, or make c:\www the default. You can't do name based virtual hosting without using a name.
Have you put entries in the hosts file for moshweb.co.uk and www.moshweb.co.uk?
 
Code:
ServerName 192.168.2.4:80
I know its an IP address but the guidence in the config file (copied below) instructs to use an IP Address if the server doesn't have a DNS name.
Apache said:
# If your host doesn't have a registered DNS name, enter its IP address here.
 
Are there any errors in error.log, and what happens if you comment out the first virtual host?
Might be worth restarting Apache too.
 
Code:
[crit] (22)Invalid argument: unable to replace stderr with error_log
[crit] (2)No such file or directory: unable to replace stderr with /dev/null
Those two lines appear a lot.
The only other lines that appear are these:
Code:
[notice] Apache/2.2.3 (Win32) DAV/2 mod_ssl/2.2.3 OpenSSL/0.9.8d mod_autoindex_color PHP/5.2.0 configured -- resuming normal operations
[notice] Server built: Sep 30 2006 21:24:06
[notice] Parent: Created child process -993895
[notice] Child -993895: Child process is running
[notice] Child -993895: Acquired the start mutex.
[notice] Child -993895: Starting 250 worker threads.
[notice] Child -993895: Listening on port 443.
[notice] Child -993895: Listening on port 80.
When I comment out the first virtual host www.moshweb.co.uk still opens the files in C:/www, moshweb.co.uk still doesn't work and as probably anticipated 192.168.2.4 doesn't work either.
At least we know how to stop things from working :p
 
The two lines sound like an error in the config - presumably there's a /dev/null in it?

In what way does moshweb.co.uk not work?

If you comment out the second one, localhost and the IP should give you c:\www. Might be worth trying duplicating the second entry and making the ServerName www.... and removing the ServerAlias.
 
I had a play about with ye olde vhost config file and it now looks like this:
Code:
NameVirtualHost 192.168.2.4

<virtualhost _default_>
</virtualhost>
<virtualhost 192.168.2.4>
    ServerName moshweb.co.uk
    DocumentRoot "C:/www/moshweb/"
</virtualhost>
<virtualhost 192.168.2.4>
    ServerName www.moshweb.co.uk
    DocumentRoot "C:/www/moshweb/"
</virtualhost>
<virtualhost 192.168.2.4>
    ServerName freakish.dyndns.tv
    DocumentRoot "C:/www/freakish/"
</virtualhost>
<virtualhost 192.168.2.4>
    ServerName localhost
    DocumentRoot "C:/www/"
</virtualhost>
<virtualhost 192.168.2.4>
    ServerName 192.168.2.4
    DocumentRoot "C:/www/"
</virtualhost>
This seems to work for people on the 'outside' of my network i.e. www.moshweb.co.uk and moshweb.co.uk both display pages in the C:/www/moshweb/ folder and freakish.dyndns.tv display pages in the C:/www/freakish folder.
However, when I type the URL's in to my web browser (internal network) the only pages that open are in the C:/www/moshweb folder? Does anyone have any idea as to how I can fix this? << NM, Fixed :)
My sincere thanks to tolien for all of his help and patience. Couldn't have got this far without you mate! You'll get a special mention on my new site!
 
Last edited:
Back
Top Bottom