HOST MULTIPLE WEB SITES WITH ONE PHYSICAL SERVER (one IP)
Install apache2
Code:
sudo apt-get install apache2
Verify that you installed apache2, open the web browser and point it to the IP address of the server.
web browser: http://192.x.x.x
Once verified, go to the www directory and make folder for each site.
Code:
cd /var/www
mkdir sitea
mkdir siteb
Copy the html files/webpages for each site on each folder.
Be sure that each folder contains the web files and index.html for each
Make a log directory for each
mkdir /var/www/logs
Edit the apache2 defaults file.
nano /etc/apache2/sites-available/default
Make it look like this:
Code:
NameVirtualHost *
<VirtualHost *>
ServerName sitea.com
ServerAlias www.sitea.com
Document Root /var/www/sitea
CustomLog /var/www/logs/sitea.log combined
ErrorLog /var/www/logs/sitea.log
</VirtualHost>
<VirtualHost *>
ServerName siteb.com
ServerAlias www.siteb.com
Document Root /var/www/siteb
CustomLog /var/www/logs/siteb.log combined
ErrorLog /var/www/logs/siteb.log
<Files “index.html”>
Order Deny, Allow
Deny from all
Allow from <IP>
</Files>
</VirtualHost>
Restart apache2
/etc/initd/apache2 restart
NOTE: Now you should have configured your DNS to have A records for both domain to point on a single IP.
Now try browsing the website using the names.
Web browser: sitea.com
Web browser: siteb.com
Bookmarks