Skip to content

Instantly share code, notes, and snippets.

@jjhiew
Last active November 4, 2020 22:18
Show Gist options
  • Save jjhiew/cbbd26da313fc550467e303a6c6f8177 to your computer and use it in GitHub Desktop.
Save jjhiew/cbbd26da313fc550467e303a6c6f8177 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