Skip to content

Instantly share code, notes, and snippets.

@cupnoodle
Last active April 1, 2016 07:28
Show Gist options
  • Select an option

  • Save cupnoodle/fb4360c9f2afe7908687 to your computer and use it in GitHub Desktop.

Select an option

Save cupnoodle/fb4360c9f2afe7908687 to your computer and use it in GitHub Desktop.
Complete HTTPS configuration with auto http redirect to https
# https server block
server {
listen 443 ssl;
server_name [your_domain] www.[your_domain];
ssl_certificate /etc/letsencrypt/live/[your_domain]/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/[your_domain]/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
root /usr/share/nginx/html;
index index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
}
# http server block, auto redirect to https
server {
listen 80;
server_name [your_domain] www.[your_domain];
return 301 https://$host$request_uri;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment