By default, Nginx caches uploaded files locally and then forwards them to the application server. How can I disable this cache so that Nginx can only forward but not cache files? This article describes in detail all the cache solutions for files uploaded by Nginx. If you have any need, refer to the following text instructions to explain all the cache solutions for files uploaded by Nginx.
Because the Application Server (Jetty) implements a progress bar during upload. Cached. The progress cannot be read. In addition, caching files in Nginx also reduces the transmission efficiency.
Nginx uses 1.5.6.
The backend uses nodejs + formidable to upload files. The corresponding content of this problem does not have much to do with the backend.
Problem:
On the front-end page, the file is uploaded. nginx does not forward all received file data blocks to the backend, but caches all the data blocks. After receiving all the data, it forwards the data blocks to the backend, obviously, the upload time is extended.
Involved modules:Ngx_http_core_module
Method:
Upgrade nginx to 1.7.11 or later.
Add command:Proxy_request_buffering off
Instructions are as follows:
Refer:
Http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_request_buffering
Restart nginx.
This solution solves the problem of caching all files uploaded by Nginx. There are more than one solution in this article. You are welcome to share your solutions.