Hi,
I'm trying to setup NGINX as a reverse proxy, cached fail over solution - similar to Newrelic's 'Always Online' feature. So far, I have it working, but now how I'd like.
What I'd like is for the cached pages to display the live web pages, and only present a cached page upon error. Is this possible? If so, I can just have DNS point to the rev proxy server.
Here is a host config.
GNU nano 2.3.6 File: origin.domain.com
server {
listen 80;
server_name origin.domain.com;
location / {
proxy_pass http://10.1.4.171/;
proxy_set_header Host $host;
proxy_cache STATIC;
proxy_cache_valid 200 2m;
proxy_ignore_headers Set-Cookie;
proxy_hide_header Set-Cookie;
proxy_cache_use_stale error timeout invalid_header updating http_403 http_500 http_502 http_503 http_504;
}
}
This is a multi host setup. Here is nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
proxy_cache_path /etc/nginx/cache levels=1:2 keys_zone=STATIC:100m inactive=24h max_size=5g;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
# Virtual Host Configs
include /etc/nginx/sites-enabled/*;
include /etc/nginx/conf.d/*.conf;
}
I'm trying to setup NGINX as a reverse proxy, cached fail over solution - similar to Newrelic's 'Always Online' feature. So far, I have it working, but now how I'd like.
What I'd like is for the cached pages to display the live web pages, and only present a cached page upon error. Is this possible? If so, I can just have DNS point to the rev proxy server.
Here is a host config.
GNU nano 2.3.6 File: origin.domain.com
server {
listen 80;
server_name origin.domain.com;
location / {
proxy_pass http://10.1.4.171/;
proxy_set_header Host $host;
proxy_cache STATIC;
proxy_cache_valid 200 2m;
proxy_ignore_headers Set-Cookie;
proxy_hide_header Set-Cookie;
proxy_cache_use_stale error timeout invalid_header updating http_403 http_500 http_502 http_503 http_504;
}
}
This is a multi host setup. Here is nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
proxy_cache_path /etc/nginx/cache levels=1:2 keys_zone=STATIC:100m inactive=24h max_size=5g;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
# Virtual Host Configs
include /etc/nginx/sites-enabled/*;
include /etc/nginx/conf.d/*.conf;
}