Skip to content

Instantly share code, notes, and snippets.

@mmmpa
Created March 11, 2015 20:36
Show Gist options
  • Save mmmpa/36cd30aa1a3f24d319f3 to your computer and use it in GitHub Desktop.
Save mmmpa/36cd30aa1a3f24d319f3 to your computer and use it in GitHub Desktop.
server {
listen 80;
server_name outer.mmmpa.net;
autoindex on;
# ファイル表示するときの
location / {
# 最終的にファイルが保存されるパスとか
root /app/outer_uploader/uploaded;
index index.html;
}
# アップロードするときの
location ~ ^/upload$ {
# 実際はベーシック認証とかかけると思う
if ($request_method = POST) {
# @sinatra は下部で定義
upload_pass @sinatra;
# @sinatra の実行者が手を出せる場所を設定する
upload_store /app/outer_uploader/temp;
upload_store_access user:rw group:rw all:rw;
upload_set_form_field "$upload_field_name[filename]" "$upload_file_name";
upload_set_form_field "$upload_field_name[tempfile]" "$upload_tmp_path";
upload_aggregate_form_field "$upload_field_name[size]" "$upload_file_size";
upload_pass_form_field ".*";
}
}
# アップロード後にパラメーターが渡されるアプリケーションへ proxy
location @sinatra {
proxy_redirect off;
proxy_pass http://localhost:1192;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment