Friday 25 September 2020

Host a SSL (https) website on Ubuntu

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


Step 1 : Enable SSL and restart Apache services

sudo a2enmod ssl

sudo service apache2 restart

STEP 2: Create a directory which contatin the certifcate and key.

Sudo Su

mkdir /etc/apache2/ssl


STEP 3: Generate self sign certificate and key

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt


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

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

<html>

<title>172.16.1.12_8080</title>

<h1>Welcome to 172.16.1.12_8080 Website</h1>

<p>Website on port 8080</p>

</html>

ctrl + X then press Y 

Press Enter


STEP 4:  Add below ServerName in apache2.conf file

/etc/apache2/apache2.conf file:

ServerName localhost


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

nano /etc/apache2/sites-available/172.16.1.12_all_ssl.conf

<VirtualHost 172.16.1.12:443>

ServerAdmin admin@localhost

ServerName  172.16.1.12

DocumentRoot /var/www/html/172.16.1.12_all

DirectoryIndex index.html

SSLEngine on

SSLCertificateFile      /etc/apache2/ssl/apache.crt

SSLCertificateKeyFile /etc/apache2/ssl/apache.key

</VirtualHost>

ctrl + X then press Y 

Press Enter


STEP 6:  Publish the website on Ubuntu

sudo a2ensite 172.16.1.12_all_ssl


STEP 7:   Restart Apache service

sudo service apache2 restart

STEP 8:   Check the website syntax

apachectl configtest

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

Host a website on Ubuntu on port 80

 Below are the steps to host a website on port 80. 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.11_80


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

nano /var/www/html/172.16.1.11_80/index.html

<html>

<title>172.16.1.11_80</title>

<h1>Welcome to 172.16.1.11_80 Website</h1>

<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.11_80


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

nano /etc/apache2/sites-available/172.16.1.11_80.conf

<VirtualHost 172.16.1.11:80>

ServerAdmin admin@localhost

ServerName  172.16.1.11

DocumentRoot /var/www/html/172.16.1.11_80

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.11_80


STEP 7:   Restart Apache service

systemctl restart apache2

Monday 21 September 2020

Host Multiple Websites on a Single Server with Apache on Ubuntu

Below config is to host multiple website which runs on different port on same server:-


Step1: Make two directories one for each port

mkdir /var/www/html/172.16.1.12_8080

mkdir /var/www/html/172.16.1.12_8081


Step2: Create index file for site on port 8080

nano /var/www/html/172.16.1.12_8080/index.html

<html>

<title>172.16.1.12_8080</title>

<h1>Welcome to 172.16.1.12_8080 Website</h1>

<p>Website on port 8080</p>

</html>

CTRL X then press Y

press Enter


Step3: Create index file for site on port 8081

nano /var/www/html/172.16.1.12_8081/index.html

<html>

<title>8081</title>

<h1>Welcome to 172.16.1.12_8081 Website</h1>

<p>Website on port 8081</p>

</html>

CTRL X then press Y

press Enter


Step4: Assign priviledge to sites

chown -R www-data:www-data /var/www/html/172.16.1.12_8080

chown -R www-data:www-data /var/www/html/172.16.1.12_8081


Step5: Add 8080 site 

nano /etc/apache2/sites-available/172.16.1.12_8080.conf

<VirtualHost 172.16.1.12:8080>

ServerAdmin admin@localhost

ServerName  172.16.1.12

DocumentRoot /var/www/html/172.16.1.12_8080

DirectoryIndex index.html

ErrorLog ${APACHE_LOG_DIR}/8080_error.log

CustomLog ${APACHE_LOG_DIR}/8080_access.log combined

</VirtualHost>

CTRL X then press Y

press Enter


Step6: Add 8081 site

nano /etc/apache2/sites-available/172.16.1.12_8081.conf

<VirtualHost 172.16.1.12:8081>

ServerAdmin admin@localhost

ServerName  172.16.1.12

DocumentRoot /var/www/html/172.16.1.12_8081

DirectoryIndex index.html

ErrorLog ${APACHE_LOG_DIR}/8081_error.log

CustomLog ${APACHE_LOG_DIR}/8081_access.log combined

</VirtualHost>

CTRL X then press Y

press Enter


Step7: Enable sites

a2ensite 172.16.1.12_8080

a2ensite 172.16.1.12_8081


Step7: Restart Apache

systemctl restart apache2

Sunday 20 September 2020

Stuck in Configuration Utility restarting - Big IP

1. Log in to BIG-IP .

2. Make a backup using below command :

 /config/httpd/conf.d/proxy_ajp.conf cp /config/httpd/conf.d/proxy_ajp.conf /config/httpd/conf.d/proxy_ajp.conf.bk

3.Edit /config/httpd/conf.d/proxy_ajp.conf 

Below is the command to make the changes. After the command press "i"  (insert) to enable the editing and once the changes are done, enter esc and type :wq!(write and quite).

vi /config/httpd/conf.d/proxy_ajp.conf

Locate the following two "#ProxyPass" lines and  the below command .

#ProxyPass /tomcat/ ajp://localhost:8009/

#ProxyPass /examples/ ajp://localhost:8009/jsp-examples/

ProxyTimeout 10            #<----- Add this line

4.Save and close the file.

5.Restart httpd and tomcat.

bigstart restart httpd tomcat


Wednesday 16 September 2020

F5 default credentials and some interesting Facts.

 Below are the default credentials for F5. you can change the credentials during initial setup wizard.

Cli

Username: root

Password: default


GUI

Username:admin

Password:admin

Interesting Fact:-

  • Root and admin username cannot be deleted from F5.
  • BY default,  username admin doesnot have access to the CLI but we can assign either advance shell or TMOS access to the "admin" user.
System >> Users : User List>> click user admin>> choose tmsh from drop down of "Terminal Access">> click update
  • No GUI access can be given to user "root"




Global NTP servers

 NTP is a UDP based service which works on port number 123.It is recommended to use pool.ntp.org to find an NTP server.

All zones in All Pool Servers.

  • Africa — africa.pool.ntp.org 
  • Antarctica — antarctica.pool.ntp.org 
  • Asia — asia.pool.ntp.org 
  • Europe — europe.pool.ntp.org 
  • North America — north-america.pool.ntp.org 
  • Oceania — oceania.pool.ntp.org 
  • South America — south-america.pool.ntp.org


Below is the command to check the ntp status on respective platforms.

A. Windows 

w32tm /query /peers

B. Ubuntu

/etc/ntp.conf

Wednesday 9 September 2020

DNS root server list - A-M

 Below is the list of root servers starting from a to m.