Skip to content

Instantly share code, notes, and snippets.

@luissquall
Created April 4, 2016 22:51
Show Gist options
  • Save luissquall/ce200ae872f18a89e6b684409d10cf6a to your computer and use it in GitHub Desktop.
Save luissquall/ce200ae872f18a89e6b684409d10cf6a to your computer and use it in GitHub Desktop.
## Redirects all HTTP traffic to the HTTPS host
##
## http://serverfault.com/questions/67316/in-nginx-how-can-i-rewrite-all-http-requests-to-https-while-maintaining-sub-dom/337893#337893
## https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/support/nginx/gitlab-ssl
## http://serverfault.com/questions/638367/do-you-need-separate-ipv4-and-ipv6-listen-directives-in-nginx/638370#638370
server {
listen 80;
listen [::]:80;
server_name {{ domain }};
return 301 https://$server_name$request_uri;
access_log /var/log/nginx/{{ domain }}.access.log;
error_log /var/log/nginx/{{ domain }}.error.log;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment