Skip to content

Instantly share code, notes, and snippets.

@joeljackson
Created June 2, 2015 21:17
Show Gist options
  • Save joeljackson/f7a21fd2c9d5ea405542 to your computer and use it in GitHub Desktop.
Save joeljackson/f7a21fd2c9d5ea405542 to your computer and use it in GitHub Desktop.
server {
listen 443 ssl;
server_name api.honest.dev;
ssl_certificate /usr/local/etc/nginx/ssl/api.crt;
ssl_certificate_key /usr/local/etc/nginx/ssl/api.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location /api {
try_files /system/maintenance.html $uri $uri/index.html $uri.html @ruby;
}
location / {
try_files /system/maintenance.html $uri $uri/index.html $uri.html @pass;
}
location @pass {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Queue-Start 't=${msec}000';
proxy_redirect off;
proxy_max_temp_file_size 0;
rewrite ^(.*)$ /api/$1 last;
}
location @ruby {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Queue-Start 't=${msec}000';
proxy_redirect off;
proxy_max_temp_file_size 0;
proxy_pass http://upstream_honest_www;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment