Easy to use

This guide will demo how to config http redirect to https.

Go to the /etc/nginx directory and edit nginx.conf file:
cd /etc/nginx/
vi nginx.conf
Edit the following configuration into it, just like below:
http {
        server {
        if ($host = www.example.com) {
                return 301 https://$host$request_uri;

Save and close it.

Finally, apply configuriton:
nginx -s reload