January 07, 2016 08:02PM
Thanks for the responses guys.

I've tried proxy_store on one config, but now I'm just receiving time-outs when I block the origin server. No stale cache on error at all.

Here are two separate configs I'm using. The first one is as described earlier, with caching and stale cache errors working, although cache is browser dependent.

proxy_cache_path /etc/nginx/cache/abc123.org levels=1:2 keys_zone=abc123:64m inactive=10d max_size=1000m;
server {
listen 443 ssl;
server_name abc123.org;
access_log /var/log/nginx/abc123.org.access.log;
error_log /var/log/nginx/abc123.org.error.log;
include ssl.conf;
#moved from location
proxy_cache_key abc123$request_uri;
location / {
proxy_cache abc123;
#proxy_cache_key abc123$request_uri;
add_header X-Proxy-Cache $upstream_cache_status;
proxy_pass https://abc123.org;
proxy_cache_valid 200 720m;
proxy_cache_valid 301 304 302 720m;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504 http_404;
expires max;
add_header Cache-control "public";
proxy_connect_timeout 3s;
proxy_read_timeout 3s;
proxy_send_timeout 3s;
proxy_cache_revalidate on;
proxy_cache_min_uses 1;
}
}
server {
listen 80;
server_name abc123.org;
return 301 https://$server_name$request_uri;
}

Config with proxy_store

proxy_cache_path /etc/nginx/cache/zxf123.org levels=1:2 keys_zone=zxf123:64m inactive=10d max_size=1000m;
server {
listen 443 ssl;
server_name zxf123.org;
access_log /var/log/nginx/zxf123.org.access.log;
error_log /var/log/nginx/zxf123.org.error.log;
include ssl.conf;
#moved from location
proxy_cache_key $host$request_uri;
location / {
#proxy_cache zxf123;
proxy_store on;
#proxy_cache_key $host$request_uri;
add_header X-Proxy-Cache $upstream_cache_status;
proxy_pass https://zxf123.org;
proxy_cache_valid 200 720m;
proxy_cache_valid 301 304 302 720m;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504 http_404;
expires max;
add_header Cache-control "public";
proxy_connect_timeout 3s;
proxy_read_timeout 3s;
proxy_send_timeout 3s;
proxy_cache_revalidate on;
proxy_cache_min_uses 1;
}
}
server {
listen 80;
server_name zxf123.org;
return 301 https://zxf123.org$request_uri;
}
Subject Author Posted

How to setup Nginx as REALLY static-cache reverse proxy

Jan Regeš December 02, 2014 07:06AM

RE: How to setup Nginx as REALLY static-cache reverse proxy

Jan Regeš December 11, 2014 01:40AM

Re: How to setup Nginx as REALLY static-cache reverse proxy

austevo January 06, 2016 12:55AM

Re: How to setup Nginx as REALLY static-cache reverse proxy

Robert Paprocki January 06, 2016 01:08AM

Re: How to setup Nginx as REALLY static-cache reverse proxy

Reinis Rozitis January 06, 2016 07:50AM

Re: How to setup Nginx as REALLY static-cache reverse proxy

austevo January 07, 2016 08:02PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 243
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready