Welcome! Log In Create A New Profile

Advanced

Re: Auto refresh for expired content?

May 18, 2017 10:02AM
Hi Roman,
hi Francis,

here comes my production config - i made a few tests the last hours, it always come to the same point - if proxy_cache_background_update is on, nginx devilvers only the cached content and is not able to fetch a fresh copy (dont know why) - i tried local files, i tried my production node.js backend, i even tried an external server as proxy_path - always the same result... :/
I hope you find something wrong in my configs and then everything is fine ;) :)
I use centos with nginx/1.12.0

Best regards,
Maik



user nginx;
worker_processes  auto;

pid        /run/nginx.pid;

worker_rlimit_nofile         50000;

events {
    worker_connections  50000;
    use epoll;
    multi_accept on;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;
log_format upstreamlog '[$time_local] $remote_addr - $remote_user - $server_name  to: $upstream_addr: $request_uri args: $args upstream_response_time $upstream_response_time msec $msec request_time $request_time';
    sendfile       on;
    tcp_nopush     on;

    keepalive_timeout   65;
    tcp_nodelay         on;
    types_hash_max_size 2048;

    proxy_cache_path /var/cache/nginx/spieldaten levels=1:2 keys_zone=spieldaten:100m max_size=150m inactive=5d use_temp_path=off;
   

    server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  xy.com;
        root         /home/nodejs/pcnode;

        access_log             off;
        error_log              off;

        gzip on;
        gzip_vary on;
        gzip_proxied any;
        gzip_comp_level 6;
        gzip_buffers 8 4k;
        gzip_http_version 1.1;
      gzip_http_version 1.1;
        gzip_min_length 256;
        gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

        try_files $uri @node;

        location @node {
            #access_log  /var/log/nginx/access.log  main;
            access_log off;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_set_header X-NginX-Proxy true;
            proxy_pass http://localhost:8088;
            proxy_redirect off;

            proxy_connect_timeout   30s;
            proxy_send_timeout      30s;
            proxy_read_timeout      30s;

            proxy_cache spieldaten;
            proxy_cache_valid 200 302 5m;
            proxy_cache_valid 404 1m;
            proxy_cache_valid any 2m;
            proxy_ignore_headers X-Accel-Expires Expires Cache-Control;
            proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
            proxy_cache_lock on;
            proxy_cache_background_update on;

        }
     }
 }
Subject Author Posted

Auto refresh for expired content?

mkuehn May 16, 2017 12:47PM

Re: Auto refresh for expired content?

Francis Daly May 16, 2017 01:20PM

Re: Auto refresh for expired content?

mkuehn May 17, 2017 03:29AM

Re: Auto refresh for expired content?

Roman Arutyunyan May 17, 2017 07:14AM

Re: Auto refresh for expired content?

mkuehn May 17, 2017 09:07AM

Re: Auto refresh for expired content?

Roman Arutyunyan May 18, 2017 07:44AM

Re: Auto refresh for expired content?

mkuehn May 18, 2017 10:02AM

Re: Auto refresh for expired content?

mkuehn May 29, 2017 10:21AM

Re: Auto refresh for expired content?

Francis Daly May 17, 2017 11:54AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 95
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready