Created
November 19, 2015 23:45
-
-
Save Melindrea/9723f22364140ae60506 to your computer and use it in GitHub Desktop.
let's encrypt setup
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
server { | |
server_name www.smaty.se; | |
# Server ports | |
listen 80; | |
listen 443 ssl http2; | |
listen [::]:80; | |
listen [::]:443 ssl http2; | |
# SSL Certificate | |
ssl_certificate /etc/letsencrypt/live/smaty.se/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/smaty.se/privkey.pem; | |
ssl_protocols TLSv1.1 TLSv1.2; | |
# Non-www redirect | |
return 301 https://smaty.se$request_uri; | |
} | |
server { | |
listen 80; | |
listen [::]:80; | |
server_name smaty.se; | |
return 301 https://smaty.se$request_uri; | |
} | |
server { | |
server_name smaty.se; | |
listen 443 ssl http2; | |
listen [::]:443 ssl http2; | |
ssl_certificate /etc/letsencrypt/live/smaty.se/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/smaty.se/privkey.pem; | |
ssl_session_timeout 1d; | |
ssl_session_cache shared:SSL:10m; | |
ssl_session_tickets off; | |
# openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 | |
ssl_dhparam /etc/nginx/ssl/dhparam.pem; | |
ssl_protocols TLSv1.1 TLSv1.2; | |
ssl_ciphers 'kEECDH+ECDSA+AES128 kEECDH+ECDSA+AES256 kEECDH+AES128 kEECDH+AES256 kEDH+AES128 kEDH+AES256 DES-CBC3-SHA +SHA !aNULL !eNULL !LOW !kECDH !DSS !MD5 !EXP !PSK !SRP !CAMELLIA !SEED'; | |
ssl_prefer_server_ciphers on; | |
add_header Strict-Transport-Security max-age=15768000; | |
ssl_stapling on; | |
ssl_stapling_verify on; | |
## verify chain of trust of OCSP response using Root CA and Intermediate certs | |
#ssl_trusted_certificate /path/to/root_CA_cert_plus_intermediates; | |
ssl_trusted_certificate /etc/letsencrypt/live/smaty.se/chain.pem; | |
resolver 8.8.8.8 8.8.4.4 valid=86400; | |
resolver_timeout 10; | |
ssl_ecdh_curve secp384r1; | |
location = /stories.html { | |
return 301 https://smaty.se/stories/$request_uri; | |
} | |
location = /author.html { | |
return 301 https://smaty.se/author/$request_uri; | |
} | |
location = /sitemap.html { | |
return 301 https://smaty.se/sitemap/$request_uri; | |
} | |
location = /colophone.html { | |
return 301 https://smaty.se/colophone/$request_uri; | |
} | |
location = /characters/mio-singh/ { | |
return 301 /characters/satinder-singh/; | |
} | |
root /srv/web/smaty.se; | |
index index.html index.htm; | |
location ~ \.(js|css|png|jpg|jpeg|gif|ico|html|woff|ttf|svg|eot|otf)$ { | |
add_header "Access-Control-Allow-Origin" "*"; | |
expires 1M; | |
include pratchett.conf; | |
access_log off; | |
add_header Cache-Control "public"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment