forked from fdintino/nginx-upload-module
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aaa500a
commit 9431767
Showing
7 changed files
with
393 additions
and
106 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
USE_MD5=YES | ||
USE_SHA1=YES | ||
USE_ZLIB=YES | ||
ngx_addon_name=ngx_http_upload_module | ||
HTTP_MODULES="$HTTP_MODULES ngx_http_upload_module ngx_http_unzip_filter_module" | ||
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_upload_module.c $ngx_addon_dir/ngx_http_unzip_filter_module.c" | ||
HTTP_MODULES="$HTTP_MODULES ngx_http_upload_module ngx_upload_unzip_filter_module ngx_upload_discard_filter_module" | ||
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_upload_module.c $ngx_addon_dir/ngx_upload_unzip_filter_module.c $ngx_addon_dir/ngx_upload_discard_filter_module.c" | ||
HTTP_INCS="$HTTP_INCS $ngx_addon_dir" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
|
||
worker_processes 20; | ||
|
||
error_log logs/error.log notice; | ||
|
||
working_directory /usr/local/nginx; | ||
|
||
events { | ||
worker_connections 1024; | ||
} | ||
|
||
http { | ||
include mime.types; | ||
default_type application/octet-stream; | ||
|
||
server { | ||
listen 80; | ||
client_max_body_size 100m; | ||
|
||
# Upload form should be submitted to this location | ||
location /upload { | ||
# Pass altered request body to this location | ||
upload_pass /test; | ||
|
||
# Store files to this directory | ||
# The directory is hashed, subdirectories 0 1 2 3 4 5 6 7 8 9 should exist | ||
upload_store /tmp 1; | ||
|
||
# Allow uploaded files to be read only by user | ||
upload_store_access user:r; | ||
|
||
# Set specified fields in request body | ||
upload_set_form_field "${upload_field_name}${upload_archive_elm}_name" $upload_file_name; | ||
upload_set_form_field "${upload_field_name}${upload_archive_elm}_content_type" $upload_content_type; | ||
upload_set_form_field "${upload_field_name}${upload_archive_elm}_path" $upload_tmp_path; | ||
upload_set_form_field "${upload_field_name}${upload_archive_elm}_archive_path" $upload_archive_path; | ||
|
||
# Inform backend about hash and size of a file | ||
upload_aggregate_form_field "${upload_field_name}${upload_archive_elm}_md5" $upload_file_md5; | ||
upload_aggregate_form_field "${upload_field_name}${upload_archive_elm}_size" $upload_file_size; | ||
|
||
upload_pass_form_field "^submit$|^description$"; | ||
|
||
upload_cleanup 400-599; | ||
|
||
upload_filter application/zip { | ||
upload_unzip on; | ||
} | ||
} | ||
|
||
# Pass altered request body to a backend | ||
location /test { | ||
proxy_pass http://localhost:8080; | ||
} | ||
} | ||
} |
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
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
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
Oops, something went wrong.