Install SSL Certificate for NGINX in Ubuntu

For installing SSL certificate for Nginx in Ubuntu you need to have two files: SSL crt file and SSL private key file and then put inside the server section in nginx.conf like the example below:
 
sudo vim /etc/nginx/nginx.conf


server {
        listen 443 ssl;
        ssl_certificate /PATH_TO_SSL_CRT_FILE.crt;
        ssl_certificate_key /PATH_TO_SSL_PRIVATE.key;
        server_tokens off;
        root /var/www;
        server_name  www.yourdomain.com;
        client_max_body_size 1G;
}

 
Then you need to restart nginx:
 
sudo service nginx restart
 

Leave a Reply

Your email address will not be published. Required fields are marked *