*** This guide assumes you already have your CSR and SSL certificate. Instructions to generate both will be added at a later time.

1. Make a backup of your configuration file

cp /etc/nginx/conf.d/linux.com.conf /etc/nginx/conf.d/linux.com.conf.bak

2. Edit the domain’s configuration file

vim /etc/nginx/conf.d/linux.com.conf

3. Add the following contents to the file – verifying that the path to the ssl_certificate and ssl_certificate_key are correct

server {

listen   443;

ssl    on;
ssl_certificate    /etc/ssl/your_domain_name.pem; (or bundle.crt)
ssl_certificate_key    /etc/ssl/your_domain_name.key;

server_name linux.com;
access_log /var/log/nginx/nginx.linux.com.access.log;
error_log /var/log/nginx/nginx.linux.com.error.log;
location / {
root   /usr/share/nginx/linux.com/;
index  index.html index.php;
}

}

Reload Nginx to apply the changes

service nginx reload

Leave a Reply

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