Created
March 28, 2013 21:35
-
-
Save feifangit/5267016 to your computer and use it in GitHub Desktop.
flask vs Nginx upload, nginx setting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream frontends { | |
server 127.0.0.1:8222; | |
} | |
server { | |
listen 8666; | |
# Allow file uploads max 50M for example | |
client_max_body_size 50M; | |
upload_buffer_size 16M; | |
# POST URL | |
location /upload { | |
# Pass altered request body to this location | |
upload_pass @after_upload; | |
# Store files to this directory | |
upload_store /tmp/xyz/; | |
# Allow uploaded files to be world readable | |
upload_store_access user:rw group:rw all:r; | |
# Set specified fields in request body | |
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"; | |
# Inform backend about hash and size of a file | |
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 "^newfilename$|^market$"; | |
upload_cleanup 400 404 499 500-505; | |
} | |
location @after_upload { | |
proxy_pass http://frontends; | |
} | |
location / { | |
proxy_pass_header Server; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Scheme $scheme; | |
proxy_pass http://frontends; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment