NGINX Configuration File Using Let's Encrypt SSL HTTPS Certificate

This is somewhat my default configuration file for all my websites I run.

This might be handy for some folks.

# Advanced config for NGINX
	server_tokens off;
	add_header X-XSS-Protection "1; mode=block";
	add_header X-Content-Type-Options nosniff;

# Redirect all HTTP traffic to HTTPS
server {
  listen 80;
  return 301 https://$host$request_uri;

# SSL configuration
server {
  listen 443 ssl default deferred;
  ssl_certificate      /etc/letsencrypt/live/;
  ssl_certificate_key  /etc/letsencrypt/live/;

# Improve HTTPS performance with session resumption
  ssl_session_cache shared:SSL:10m;
  ssl_session_timeout 5m;

# Enable server-side protection against BEAST attacks
  ssl_prefer_server_ciphers on;

# Disable SSLv3
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

# Diffie-Hellman parameter for DHE ciphersuites
# $ sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 4096
  ssl_dhparam /etc/ssl/certs/dhparam.pem;

# Enable HSTS (
  add_header Strict-Transport-Security "max-age=63072000; includeSubdomains";

# Enable OCSP stapling (
  ssl_stapling on;
  ssl_stapling_verify on;
  ssl_trusted_certificate /etc/letsencrypt/live/;
  resolver valid=300s;
  resolver_timeout 5s;

# Required for LE certificate enrollment using certbot
  location '/.well-known/acme-challenge' {
    default_type "text/plain";
    root /var/www/html;
  location / {
    root /var/www/html;