Everyone knows that transferring private data like credentials, payment information over insecure protocol is not secure. They can easily be sniffed by an MITM attackers. This tutorial will help you redirect all incoming request on http to https url in Nginx web server.
Nginx Redirect HTTP to HTTPS
Edit http virtual host configuration file for your domain and add “return 301 https://$host$request_uri
” statement under server section. This will redirect all the incoming requests on HTTP to corresponding https urls.
server { listen 80 default_server; listen [::]:80 default_server; server_name _; return 301 https://$host$request_uri; }
After making changes reload or restart Nginx server.
Leave a Reply