Created
January 10, 2017 00:10
-
-
Save sebastiaanluca/9a43ff4abf332f3c1d75be7624ecf48f to your computer and use it in GitHub Desktop.
nginx virtual host configuration file where `[::]` handles IPv6 IPs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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