M
M
mafet2011-12-08 01:01:28
Nginx
mafet, 2011-12-08 01:01:28

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

10 answer(s)
A
Alexander, 2011-12-08
@akalend

and one more piece of advice: throw out Apache on ...
nginx can work with all the languages ​​\u200b\u200bthat Apache works with

A
anycolor, 2011-12-08
@anycolor

What prevents where Apache stands - to install nginx and give the file directly from it?

D
darkdimius, 2011-12-18
@darkdimius

Pay attention to such a nginx fin as XSendfile .
You can only place the file on nginx, and Apache will say "give it away".

K
KawaiDesu, 2011-12-08
@KawaiDesu

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.

V
Vlad Zhivotnev, 2011-12-08
@inkvizitor68sl

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.

A
Alex Bunin, 2011-12-08
@azxc

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.

A
Alexander, 2011-12-08
@akalend

>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

H
homm, 2011-12-08
@homm

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.

B
Boris Syomov, 2011-12-09
@kotomyava

Configure proxy_cache for static. And it will start serving from the second request from the frontend, without additional tricks.

M
mafet, 2011-12-18
@mafet

Finally got around to it - in general, I did everything on nfs and everything is now working fine. Raise another nginx - make another domain on each site and you can really bother with the logic.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question