Skip to content

Instantly share code, notes, and snippets.

Created March 6, 2018 07:45
Show Gist options
  • Save anonymous/43a072589a9c41fc76924cd9e3397789 to your computer and use it in GitHub Desktop.
Save anonymous/43a072589a9c41fc76924cd9e3397789 to your computer and use it in GitHub Desktop.
server {
root /var/www/html/example.com/;
server_name example.com www.example.com;
location ~* \.(jpg|jpeg|png|gif|ico|css|js|ttf|woff|pdf)$ {
expires 365d;
}
# managed by Certbot
listen 443 ssl http2; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = www.example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name example.com www.example.com;
listen 80;
return 404; # managed by Certbot
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment