Skip to content

Instantly share code, notes, and snippets.

@sebastiaanluca
Created January 10, 2017 00:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sebastiaanluca/9a43ff4abf332f3c1d75be7624ecf48f to your computer and use it in GitHub Desktop.
Save sebastiaanluca/9a43ff4abf332f3c1d75be7624ecf48f to your computer and use it in GitHub Desktop.
nginx virtual host configuration file where `[::]` handles IPv6 IPs.
# Redirect non-secure http requests to secure https domain
# Redirect non-www requests to www.site.com
server {
listen 0.0.0.0:80;
listen [::]:80;
listen 0.0.0.0:443 ssl http2;
listen [::]:443 ssl http2;
server_name domain.com *.domain.com;
return 301 https://www.$server_name$request_uri;
}
server {
listen 0.0.0.0:443 ssl http2 default_server;
listen [::]:443 ssl http2;
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment