Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save anderfernandes/88cb2888c57fc3d88f904f0a88e524fb to your computer and use it in GitHub Desktop.
Save anderfernandes/88cb2888c57fc3d88f904f0a88e524fb to your computer and use it in GitHub Desktop.
nginx http redirect to https (whole server instance)
# Redirect HTTP request to HTTPS
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
return 301 https://$host$request_uri;
}
# HTTPS settings
server {
listen 443 default_server;
... # the rest of the standard HTTPS configuration
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment