(2 votes, average: 5.00 out of 5)
Loading...
Installing an SSL certificate on your NGINX web server is a great way to secure your website & improve the trustworthiness of your online presence. This guide will provide you with step-by-step instructions on how to install an SSL certificate on your NGINX web server.
The Prerequisites for Installing SSL Certificate on NGINX
The Certificate Authority will provide you the SSL through a Zip folder, which contains primary certificate, root & intermediate certificate. You have to merge all three files into a single document.
To do this manually
You can make this process a little easy using the command-line:
Run this command if the intermediate certificates are in a single bundle.
cat your_domain.crt your_domain.ca-bundle >> ssl-bundle.crt
Run this command if all three certificates are listed separately.
cat your_domain.crt intermediate.crt root.crt >> ssl-bundle.crt
Now, it’s time to set up the virtual host file on your machine, it is the NGINX server block that sets up the configuration of your domain. Open the virtual host file with a text editor; if you don’t know the location it run ‘sudo find nginx.conf‘ command and make the following changes to configure your virtual host file.
The Virtual Host file will look like this.
server {
listen 443;
ssl on;
ssl_certificate /etc/ssl/ssl-bundle.crt;
ssl_certificate_key /path/to/your_private.key;
root /path/to/webroot;
server_name your_domain.com;
}
access_log /var/log/nginx/nginx.vhost.access.log;
error_log /var/log/nginx/nginx.vhost.error.log;
location /
{
root /var/www/;
root /home/www/public_html/your.domain.com/public/;
index index.html;
}
}
Save and exit the file and restart NGINX Server. Simply run the command:
sudo systemctl restart nginx
The Final step is to verify the SSL Installation, open a web browser and enter your domain name in the address bar. If you see padlock and HTTPS in the URL bar, it indicates the SSL is installed perfectly
Or use our Free SSL Checker tool to make sure the SSL is installed correctly!
If you have trouble with your SSL Certificate installation, please check the following points: