Setup SSL for Nginx KodeKloud Engineer ๐Ÿ‘จโ€๐Ÿ’ป Task 27 #Linux #DevOps โ™พ

Requirement : The system admins team of xFusionCorp Industries needs to deploy a new application on App Server 2 in Stratos Datacenter. They have some pre-requites to get ready that server for application deployment. Prepare the server as per requirements shared below:

  1. Install and configure nginx on App Server 2.
  2. On App Server 2 there is a self signed SSL certificate and key present at location /tmp/nautilus.crt and /tmp/nautilus.key. Move them to some appropriate location and deploy the same in Nginx.
  3. Create an index.html file with content Welcome! under Nginx document root.
  4. For final testing try to access the App Server 2 link (either hostname or IP) from jump host using curl command. For example curl -Ik https://<app-server-ip>/.

Solution : First Instal Extra Packages for Enterprise Linux (EPEL)

yum install epel-release -y

Next we will Install nginx

yum install nginx -y

Now, as we already have our SSL Key and SSL Certification ๐ŸŽ“. We will move them to their respective location, in our case it will be :

mv /tmp/nautilus.crt /etc/pki/CA/certs/
mv /tmp/nautilus.key /etc/pki/CA/private/

Once installed, we will update the config file. Here, we will uncomment the # Settings for a TLS enabled server. And update the server name to the IP address of our server as well as the SSL key and certification path ๐Ÿ“‚

vi /etc/nginx/nginx.conf

Next we will edit index.html using vi editor ๐Ÿ“ but before editing we will need to remove the symbolic link and then add the content in index.html

rm /usr/share/nginx/html/index.html
vi /usr/share/nginx/html/index.html

Start the nginx server ๐Ÿ’ป and make sure to check the status of your nginx server

systemctl start nginx

Go to Bastion Host and confirm the task completion ๐Ÿš€

curl -Ik https://<your-server-ip>/

Thank You ๐Ÿ•บ

0
Subscribe to my newsletter

Read articles from Sudarshan Bhamare directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Sudarshan Bhamare
Sudarshan Bhamare