Photo by Eduardo Rosas: https://www.pexels.com/photo/gray-laptop-computer-showing-calculator-application-with-codes-907487/

Updating Nginx Server Configuration To Use The SSL You Have Purchased

You need to update the config file on your server to use the SSL certificate you are subscribed to. This can be done by accessing the command line SSH and opening the Nginx config file for the domain you are installing the SSL certificate.

Simply run the following command:

sudo vim /etc/nginx/sites-available/yourwebsite.com

Now update the config file to use the SSL certificate:

server {
        listen 80;
        server_name yourwebsite.com;
        return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;

    server_name yourwebsite.com;
    ssl_certificate     /etc/nginx/ssl/yourwebsite.crt;
    ssl_certificate_key /etc/nginx/ssl/yourwebsite.key;

    root /usr/share/nginx/yourwebsite.com/;
    index index.php  index.html index.htm;

}

The next step is to save the file using this command:

wq!

And then restart your Nginx server with this command:

sudo service nginx restart

That’s it.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.