Skip to content

Instantly share code, notes, and snippets.

@daliborgogic
Last active May 15, 2019 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daliborgogic/0bfe6e4c71aad6db96ea25089389498f to your computer and use it in GitHub Desktop.
Save daliborgogic/0bfe6e4c71aad6db96ea25089389498f to your computer and use it in GitHub Desktop.
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name example.com;
return 301 https://example.com$request_uri;
}
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name example.com;
include /etc/nginx/include/ssl;
location / {
proxy_pass http://x.x.x.x:3000;
include /etc/nginx/include/proxy;
}
)
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_ssl_session_reuse off;
proxy_set_header Host $http_host;
proxy_redirect off;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
add_header X-Cache-Status $upstream_cache_status;
keepalive_timeout 70;
ssl_session_tickets on;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/nginx/dhparam.pem;
ssl_ciphers 'ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH:EECDH+AESGCM:EDH+AESGCM:ECDHE-RSA-AES128-GCM-SHA256:AES256+EECDH:DHE-RSA-AES128-GCM-SHA256:AES256+EDH:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA';
@daliborgogic
Copy link
Author

daliborgogic commented May 15, 2019

# Generate Wildcard SSL certificate using Let's Encrypt/Certbot
$ sudo certbot && \
  -a dns-digitalocean && \
  --dns-digitalocean-credentials ~/.secrets/certbot/digitalocean.ini && \
  --dns-digitalocean-propagation-seconds 600 && \
  -i nginx && \
  -d "*.example.com" && \
  -d example.com && \
  --server https://acme-v02.api.letsencrypt.org/directory

@daliborgogic
Copy link
Author

daliborgogic commented May 15, 2019

# some people would tell you to use pre-defined Diffie-Hellman parameters
$ openssl dhparam -out /etc/nginx/dhparam.pem 4096

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment