Install Nginx server and secure your website with Certbot SSL ON Ubuntu 18

Install Nginx server and secure your website with Certbot SSL ON Ubuntu 18

WEB Server

A web server is computer software and underlying hardware that accepts requests via HTTP and HTTPS the network protocol created to distribute web pages and multimedia content via internet or intranet.

Some famous Web services

  • Apache

  • IIS

  • NGINX

  • Tomcat

Here i am going to explain how to install Nginx webserver and how to configure it

First update your server with latest packages.

sudo apt-get update -y

image.png

then install nginx latest version.

sudo apt-get install nginx -y

image.png

allow nginx required forts in firewall.

sudo ufw allow 'Nginx Full'

image.png

Give folder permission to your Webroot

chown -R $USER:$USER /var/www/html/

chmod -R 755 /var/www/html/

image.png

create index.html file in Webroot

echo "Shivam" > /var/www/html/index.html

image.png

Check the nginx status and restart it.


sudo service nginx status

sudo service nginx restart

image.png

Install snapd package manager and enable on start up

sudo apt install snapd -y

sudo systemctl enable --now snapd

install certbot using snapd and create s symbolic link

sudo snap install --classic certbot

sudo ln -s /snap/bin/certbot /usr/bin/certbot

run certbot and get certificate

sudo certbot --nginx

add certbots PPA repository and update the os.

 sudo add-apt-repository ppa:certbot/certbot -y

sudo apt-get update -y

image.png

Now we are going to install nginx certbot package.

sudo apt install python-certbot-nginx -y

image.png

after that we are going to get ssl using certbot

Syntax sudo certbot --nginx -d domainname.com -d domainame.com

sudo certbot --nginx -d www.try.venketraman.com -d try.venketraman.com

image.png

first it asks mail id for renewal notification

after that its asks agree the license agreement

image.png

after that its asks http to https redirection

image.png

Give no 2 for certbot auto redirection

image.png

image.png

now you can check your website is secured with ssl.

image.png

additionally you can check your certificate trust level in ssl labs website.

SSLLabs

image.png

In this article i have explained how to install nginx and how to configure ssl .

Did you find this article valuable?

Support venket's b log by becoming a sponsor. Any amount is appreciated!