In this post, I will share my very simple configuration to redirect HTTP to HTTPS using Nginx web server.
With my configuration below, Nginx will simply forwards port 80 to 443. Very useful when you have a service that only listens on 443 (https) then you can use Nginx to forward all of your HTTP requests to HTTPS (your actual service)
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
return 301 https://$host$request_uri;
access_log logs/host.access.log main;
I hope this post is useful for you, if you have any questions or comments, feel free to post them down below.