From 9ff633ccfe6be2f10dcff99c06dbfe4a2c580f1e Mon Sep 17 00:00:00 2001 From: Keegan McAllister Date: Mon, 22 Oct 2012 17:53:35 -0400 Subject: [PATCH] Add nginx config This is not yet hooked up to Puppet. (imported from commit 1d0368285a5a9ef5a4af0651001db4930cf77578) --- .../puppet/files/nginx/sites-available/humbug | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 servers/puppet/files/nginx/sites-available/humbug diff --git a/servers/puppet/files/nginx/sites-available/humbug b/servers/puppet/files/nginx/sites-available/humbug new file mode 100644 index 0000000000..5ab58849dd --- /dev/null +++ b/servers/puppet/files/nginx/sites-available/humbug @@ -0,0 +1,53 @@ +server { + listen 80; + server_name app.humbughq.com; + return 301 https://$server_name$request_uri; +} + +server { + listen 443; + + ssl on; + ssl_certificate /etc/ssl/certs/app.humbughq.com.combined-chain.crt; + ssl_certificate_key /etc/ssl/private/app.humbughq.com.key; + + server_name app.humbughq.com; + access_log /var/log/nginx/humbug.access.log; + error_log /var/log/nginx/humbug.error.log; + + # Enable HSTS: tell browsers to always use HTTPS + add_header Strict-Transport-Security max-age=15768000; + + # Avoid clickjacking attacks + add_header X-Frame-Options DENY; + + # Serve a custom error page when the app is down + error_page 502 503 504 /static/public/html/5xx.html; + + # Serve static files directly + location /static/ { + alias /home/humbug/humbug/zephyr/static-access-control/; + expires 30d; + } + + # Send longpoll requests to Tornado + location ~ /json/get_updates|/api/v1/get_messages { + proxy_pass http://localhost:9993; + proxy_redirect off; + + # Needed for longpolling + proxy_buffering off; + proxy_read_timeout 1200; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + + # Send everything else to Django via FastCGI + location / { + include fastcgi_params; + fastcgi_pass unix:/home/humbug/humbug/fastcgi-socket; + fastcgi_split_path_info ^()(.*)$; + } +}