Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need to set up my computer to serve pages to all computers on the LAN. The main page of my site (i.e. the one with out a sub-domain) works, the other computers can access it at http://vulpecula (the name of my computer) but when they try to access the subdomains they get redirected to www.subdomain.vulpecula, which doesn't work.

Strangely when I go to the subdomain on my own computer it doesn't redirect and works fine. I have also tried with all lowercase server names, but this makes no difference.

I've included the contents of 2 files below for help:

/etc/hosts:

192.168.1.103    Vulpecula    # Added by NetworkManager
127.0.0.1    localhost.localdomain    localhost
::1    Vulpecula    localhost6.localdomain6    localhost6

127.0.0.1 subdomain.vulpecula
127.0.0.1 extra.vulpecula

192.168.1.103 subdomain.vulpecula
192.168.1.103 extra.vulpecula

#::1    Vulpecula    localhost6.localdomain6    localhost6
#127.0.1.1    Vulpecula

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

/etc/apache2/httpd.conf

NameVirtualHost *:80

<VirtualHost *:80>

DocumentRoot /home/thomas/hello
<Directory />
Options FollowSymLinks
 AllowOverride None
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerName subdomain.vulpecula
DocumentRoot /home/thomas/sub/0.0.6
</VirtualHost>

<VirtualHost *:80>
ServerName extra.vulpecula
DocumentRoot /home/thomas/hello
</VirtualHost>
share|improve this question
add comment

1 Answer 1

You can either:

  1. Put subdomain.vulpecula into the /etc/hosts files of all clients; or
  2. Put subdomain.vulpecula into your LAN's internal DNS.

What is likely happening on the other computers on your LAN is that subdomain.vulpecula is an unknown name, so their browsers tack on the 'www.' prefix in an attempt to find a name that resolves. Once you have ensured that subdomain.vulpecula resolves to a valid IP address, this problem should go away.

share|improve this answer
    
Thanks for the reply, how do I add to the LANs DNS? –  user57499 Oct 18 '10 at 20:35
    
@TomC: I think that should probably be a separate question! The short answer is: consult your DNS server's documentation. –  Steven Monday Oct 18 '10 at 21:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.