Setup SSL for Nginx KodeKloud Engineer 👨💻 Task 27 #Linux #DevOps ♾
Install and configure nginx on App Server 2
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:
- Install and configure
nginx
onApp Server 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. - Create an
index.html
file with contentWelcome!
under Nginx document root. - For final testing try to access the
App Server 2
link (either hostname or IP) fromjump host
using curl command. For examplecurl -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 🕺