Apache have a concept of Virtual Hosts which allows you to configure multiple websites on a single IP Address using multiple hostnames or ports. If you haven’t already done it, install Apache on your Ubuntu instance:
apt-get install apache2
Create a new conf file in /etc/apache2/sites-available or use an existing one. Add the ports for different site directories:
<VirtualHost *:11235> DocumentRoot /var/www/w1 <Directory /var/www/w1> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> </VirtualHost> <VirtualHost *:11236> DocumentRoot /var/www/w2 <Directory /var/www/w2> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> </VirtualHost>
and then set Apache tolisten on the ports in the /etc/apache2/ports.conf file:
Listen 11235 Listen 11236
Restart the Apache service. You should now be able to browse both ports using the same ip address. If your ip was 111.111.111.111 then w1 directory on 111.111.111.111:11235 and 111.111.111.111:11236.
If your domain is pointing to a IP, you can use different hostnames without making change to DNS. If you domain was mydomain.com, you could instead add new virtual host names with:
<VirtualHost *:80> ServerName w1.mydomain.com DocumentRoot /var/www/w1 <Directory /var/www/w1> Options +Includes -Indexes +FollowSymLinks AllowOverride All Order allow,deny allow from all </Directory> </VirtualHost> <VirtualHost *:80> ServerName w2.mydomain.com DocumentRoot /var/www/w2 <Directory /var/www/w2> Options +Includes -Indexes +FollowSymLinks AllowOverride All Order allow,deny allow from all </Directory> </VirtualHost>