Saturday, December 27, 2014

networking - Setting up Apache on Ubuntu to server subdomains on LAN

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



DocumentRoot /home/thomas/hello

Options FollowSymLinks
AllowOverride None





ServerName subdomain.vulpecula
DocumentRoot /home/thomas/sub/0.0.6



ServerName extra.vulpecula
DocumentRoot /home/thomas/hello


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...