D
D
Dnebl2015-12-09 16:54:55
Nginx
Dnebl, 2015-12-09 16:54:55

Can Nginx handle static like this?

Hello, can Nginx work like this. When requesting statics, if Nginx does not have it, it sends the request to Apache, it returns it, and does nginx store it and then give back the saved one?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
D
Dan Ivanov, 2015-12-09
@Dnebl

Dnebl it seems to me that you are describing the mechanism of the proxy_store

E
evnuh, 2015-12-09
@evnuh

maybe: try_files from here nginx.org/en/docs/http/ngx_http_core_module.html
then think about how to put it all together

S
sunrails, 2015-12-09
@sunrails

Checking the existence of the file nginx.org/ru/docs/http/ngx_http_core_module.html#t...
Passing requests to another server + cache nginx.org/ru/docs/http/ngx_http_proxy_module.html

U
un1t, 2015-12-09
@un1t

Google for proxy_pass and proxy_cache.

P
Puma Thailand, 2015-12-09
@opium

maybe
tryfiles + proxy cache

A
Alexey Timofeev, 2015-12-17
@alextimofeyev7

I use this construction
location / {
root /www/ ;
if ($http_x_mirrored != "yes") {
error_page 404 = @fetch;
}
}
location @fetch {
internal;
proxy_pass http://otherhosts;
proxy_next_upstream error timeout invalid_header http_404;
proxy_store on;
proxy_store_access user:rw group:rw all:rw;
root /www;
proxy_set_header X-Mirrored yes;
expires 30d;
}
Hope it helps, good luck.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question