Skip to content

Instantly share code, notes, and snippets.

@vesper8
Forked from jjhiew/default.nginx.conf
Created October 7, 2018 09:10
Show Gist options
  • Save vesper8/7185aa5f630da5a9dc82ae61f4c3b8f4 to your computer and use it in GitHub Desktop.
Save vesper8/7185aa5f630da5a9dc82ae61f4c3b8f4 to your computer and use it in GitHub Desktop.
Nginx configuration to setup SSL Termination and Reverse Proxy for Sendgrid Link Tracking
# Should go into `/etc/nginx/sites-available` as file named `default`
# Redirect HTTP to HTTPS
server {
listen 80;
return 301 https://$host$request_uri;
}
server {
listen 443;
server_name links.yourdomain.com;
ssl_certificate /etc/letsencrypt/live/links.yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/links.yourdomain.com/privkey.pem;
ssl on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'HIGH:AES-GCM:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-CBC-SHA:ECDHE-RSA-AES128-GCM-SHA256:!SSLv3:!SSLv2:!EXPORT:!DH:!DES:!3DES:!MD5:!DHE:!ADH:!EDH';
ssl_prefer_server_ciphers on;
ssl_session_timeout 5m;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_ssl_session_reuse on;
proxy_send_timeout 300s;
proxy_pass https://sendgrid.net;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment