Skip to content

Instantly share code, notes, and snippets.

@evemilano
Created July 17, 2018 22:47
Show Gist options
  • Save evemilano/19240112df4666a6c9f7ecf3dc867160 to your computer and use it in GitHub Desktop.
Save evemilano/19240112df4666a6c9f7ecf3dc867160 to your computer and use it in GitHub Desktop.
Nginx HTTP to HTTPS 301 redirect
#blocco di redirect HTTP
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name www.evemilano.com evemilano.com;
return 301 https://www.evemilano.com$request_uri;
}
#blocco di redirect IP
server {
listen 80;
server_name 82.196.0.237;
return 301 $scheme://www.evemilano.com$request_uri;
}
#blocco default HTTPS
server {
# Gestione SSL
listen 443 ssl;
...
}
@evemilano
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment