Tuesday 22 September 2020

Host a website on Ubuntu on multiple ports

 Below are the steps to host a website on multiple ports. In the below example 172.16.1.11 is the IP adddress on the Ubuntu server which will receive the customer traffic.


STEP 1: Create a directory which will contain the HTML page of the website.

Sudo Su

mkdir /var/www/html/172.16.1.10_all


STEP 2:  Create the index html file and add the HTML code in it

nano /var/www/html/172.16.1.10_all/index.html

<html>

<title>172.16.1.10</title>

<h1>Welcome to 172.16.1.10 Website</h1>

<body style="background-color:orange;">

</body>

<p>Website on port 80</p>

</html>

ctrl + X then press Y 

Press Enter


STEP 4:  Give Sufficient permission to the folder

chown -R www-data:www-data /var/www/html/172.16.1.10_all


STEP 5:   Add the website to the "SITES-AVAILABLE" FOLDER.

nano /etc/apache2/sites-available/172.16.1.10_all.conf

<VirtualHost 172.16.1.10:*>

ServerAdmin admin@localhost

ServerName  172.16.1.10

DocumentRoot /var/www/html/172.16.1.10_all

DirectoryIndex index.html

ErrorLog ${APACHE_LOG_DIR}/80_error.log

CustomLog ${APACHE_LOG_DIR}/80_access.log combined

</VirtualHost>

ctrl + X then press Y 

Press Enter


STEP 6:  Publish the website on Ubuntu

a2ensite 172.16.1.10_all


STEP 7:   Restart Apache service

systemctl restart apache2

1 comment:

  1. Technology has led to increased automation, streamlining various processes and reducing manual labor in industries.[url=https://futbollibre.co.uk/]futbollibre[/url]

    ReplyDelete