diff options
Diffstat (limited to 'solve/nginx.conf')
| -rw-r--r-- | solve/nginx.conf | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/solve/nginx.conf b/solve/nginx.conf new file mode 100644 index 0000000..2dc089c --- /dev/null +++ b/solve/nginx.conf @@ -0,0 +1,63 @@ +worker_processes 1; + +# Import njs module +# https://nginx.org/en/docs/njs/ +load_module modules/ngx_http_js_module.so; + +events { + worker_connections 1024; +} + + +http { + # Import custom njs script + # Allows to join files together + js_path "/etc/nginx/http/"; + js_import main from join.js; + + root /usr/share/nginx/html/; + + server { + listen 1024; + + # Serve index + location / { + } + + # Nginx direct file upload using client_body_in_file_only + # https://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_in_file_only + location /upload { + limit_except POST { deny all; } + client_body_temp_path /usr/share/nginx/html/data; + client_body_in_file_only on; + client_body_buffer_size 128K; + client_max_body_size 50M; + proxy_pass_request_headers on; + proxy_set_body $request_body_file; + proxy_pass http://localhost:8080/upload; + proxy_redirect off; + } + + # Allows to join multiple files + # Either returns a string or binary data + location /join { + js_content main.join; + } + + # List all uploaded files + location /data { + autoindex on; + } + + } + + # Backend server + server { + server_name localhost; + listen 8080; + + location /upload { + return 200 "File uploaded"; + } + } +} |
