I'm running Ubuntu 13.04 64-bit (Ubuntu 12.04.3 LTS) This is fresh install. How do I configure LAMP to run Apache2 on each PC through a four port router. I want one PC to act as the primary server, with the ability to serve its own web content, while having the other PCs available to receive specific domain requests and server pages.
I have the following domain:
I have the following A Host:
I want each server to respond to calls without a port prefixing the URL.
I am running through the instructions on Virtual Hosts from Ubuntu Documentation ApacheMySQLPHP wiki
Apache2 has the concept of sites, which are separate configuration files that Apache2 will read. These are available in /etc/apache2/sites-available. By default, there is one site available called 000-default. This is what you will see when you browse to
http://localhost or http://127.0.0.1. You can have many different site configurations available, and activate only those that you need.
As an example, we want the default site to be /home/user/public_html/. To do this, we must create a new site and then enable it in Apache2.
To create a new site:
- Copy the default website as a starting point.
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mysite.conf
- Edit the new configuration file in a text editor
sudo nanoon the command line, for example:
sudo nano /etc/apache2/sites-available/mysite.conf. The keyboard shortcuts for saving a file in nano and closing nano are always at the bottom of every page in nano.
- Change the DocumentRoot to point to the new location. For example,
- Change the Directory directive, replace "Directory /var/www/" by "Directory /home/user/public_html/"
- You can also set separate logs for each site. To do this, change the ErrorLog and CustomLog directives. This is optional, but handy if you have many sites
- Save the file
Now, we must deactivate the old site, and activate our new one. Ubuntu provides two small utilities that take care of this: a2ensite (apache2enable site) and a2dissite (apache2disable site).
sudo a2dissite default && sudo a2ensite mysite
Finally, we restart Apache2:
sudo /etc/init.d/apache2 restart
If you have not created /home/user/public_html/, you will receive an warning message
To test the new site, create a file in /home/user/public_html/:
echo '<b>Hello! It is working!</b>' > /home/user/public_html/index.html
Example: srv1.showmemn.com NOT srv1.showmemn.com:8080
I use Godaddy to forward DNS requests from the main IP to the router. All internal requests are then referenced via port forwarding:
⠀srv1.showmemn.com (port forwards to 10.0.0.2)
⠀srv2.showmemn.com (port forwards to 10.0.0.5)
Any help would be greatly appreciated. In addition I have not altered /etc/host file, I would like to do this the correct way since all my attempts have failed.
In addition, I set up the host file with the following:
127.0.0.1 localhost 127.0.1.1 svr2 10.0.0.2 srv2.showmemn 10.0.0.25 srv1.showmemn.com # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters