Answer the question
In order to leave comments, you need to log in
nginx and serving large files
There is a bunch of nginx and apache. Everything seems to be fine until it comes to large files (500mb+)
Google has shown that this is usually solved by placing the file locally on the server with nginx, but what if the server with nginx and apache are different servers? It is clear that nfs decides here, but this is somehow a crutch. Is it possible to make nginx emit a stream directly from apache?
Answer the question
In order to leave comments, you need to log in
and one more piece of advice: throw out Apache on ...
nginx can work with all the languages \u200b\u200bthat Apache works with
What prevents where Apache stands - to install nginx and give the file directly from it?
Pay attention to such a nginx fin as XSendfile .
You can only place the file on nginx, and Apache will say "give it away".
What is meant by "stream from apache"?
In principle, if the return does not come from php (and if so, then this, IMHO, is a design error), then either transfer the statics to the server from nginx, or the same NFS.
Look towards proxy_cache. Set it up right.
Most likely, you have large files cached. And since it is customary for us to save on memory, it is cached to disk. And this is where the worst feature of all modern servers comes into play - very slow disks.
I have nginx and apache on the same server.
It works according to a fairly standard scheme: all requests are received by nginx, and then the dynamic content is transferred further to apache through proxy_pass, and the static content is processed by nginx itself.
>Is it possible to force nginx to issue a stream directly from apache?
nginx does this
1) do not give large files from the app through nginx, give them directly
2) store large files there - where are you going to give them from
if nginx and apache are on different servers, then raise another nginx on the server where the content is located
3 ) if you need to somehow protect access to files through a script - use the appropriate modules: ngx_http_accesskey_module
4) if you need to upload a file, then use the appropriate modules: ngx_http_upload_module
Nginx should serve huge files directly from disk (even if it's nfs), it doesn't make sense to discuss it. Any attempt to give the Enginix a large file with something else (no matter what) leads to folding this file onto disk in a temporary folder and returning it from there.
Configure proxy_cache for static. And it will start serving from the second request from the frontend, without additional tricks.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question