Skip to content

Instantly share code, notes, and snippets.

@kyv
Created August 28, 2012 18:01
Show Gist options
  • Save kyv/3501465 to your computer and use it in GitHub Desktop.
Save kyv/3501465 to your computer and use it in GitHub Desktop.
sinatra nginx config
upstream unicorn {
server unix:/tmp/.sock fail_timeout=0;
}
server {
listen 80;
server_name xyz.org;
rewrite ^(.*) https://$host$1 permanent;
}
server {
client_max_body_size 100m;
listen 443;
server_name xyz.org;
root /srv/http;
ssl on;
ssl_certificate /etc/nginx/ssl/cert-flujos.org.crt;
ssl_certificate_key /etc/nginx/ssl/flujos.org.key;
location /audio {
alias /srv/http/files;
}
location /upload {
upload_pass @sinatra;
upload_store /tmp 1;
upload_store_access group:r;
upload_set_form_field $upload_field_name.name "$upload_file_name";
upload_set_form_field $upload_field_name.content_type "$upload_content_type";
upload_set_form_field $upload_field_name.path "$upload_tmp_path";
upload_aggregate_form_field "$upload_field_name.md5" "$upload_file_md5";
upload_aggregate_form_field "$upload_field_name.size" "$upload_file_size";
upload_pass_form_field "^submit$|^description$";
upload_cleanup 400 404 499 500-505;
}
try_files $uri/index.html $uri.html $uri @sinatra;
location @sinatra {
include proxy.conf;
proxy_set_header X-Forwarded-Proto https;
proxy_pass http://unicorn;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment