Configuring https redirection in Nginx

HydraFerret: Multi-sensor IOT with a simple interface.


↓↓ Dig deeper ↓↓


To configure a redirect to https from any URL on http in Nginx, use a server stanza similar to the following, using either a 301 (moved permanently) or 302 (moved temporarily), or 307 (moved temporarily) return code:

server {
        listen 80 ;
        listen [::]:80 ;
        return 301 https://$host$request_uri;
        add_header X-Frame-Options "SAMEORIGIN";
}



Thank you for visiting this websiteHome