cache issue with cms

absolutely_free at libero.it absolutely_free at libero.it
Tue Jul 5 16:25:09 UTC 2016


Hi,
I am using nginx version 1.10.1 with reverse proxy function toward Apache 2.2.15 I noticed that if I change something inside backend (eg. modify some text on some article), that changes appear on frontend, but I still view old post's content into backend.
I tried to disable any caching mechanism for /wp-admin and /wp-login
 I hope I did this properly, can you help me in order to figure some errors with this configuration?

This is my nginx global config:
####################################################user nginx nginx;worker_processes 4;
error_log /var/log/nginx/error.log;
events {    worker_connections  1024;}
http {    include /etc/nginx/mime.types;    default_type application/octet-stream;
# Defines the cache log format, cache log location# and the main access log location.        log_format cache '***$time_local '        '$upstream_cache_status '        'Cache-Control: $upstream_http_cache_control '        'Expires: $upstream_http_expires '        '$host '        '"$request" ($status) '        '"$http_user_agent" '        'Args: $args '        'Wordpress Auth Cookie: $wordpress_auth ';    access_log /var/log/nginx/cache.log cache;    access_log /var/log/nginx/access.log;
    # Proxy cache and temp configuration.    proxy_cache_path /mnt/ramdisk/nginx_cache levels=1:2                     keys_zone=main:10m                     max_size=1g inactive=30m;    proxy_temp_path /mnt/ramdisk/nginx_temp;    proxy_ignore_headers X-Accel-Expires Expires Cache-Control Set-Cookie;    proxy_hide_header Pragma;    proxy_hide_header Expires;    proxy_hide_header Cache-Control;    expires 1d;
# Gzip Configuration.    gzip_vary off;    gzip on;    gzip_disable msie6;    gzip_static on;    gzip_comp_level 4;    gzip_proxied any;    gzip_types text/plain               text/css               application/x-javascript               text/xml               application/xml               application/xml+rss               text/javascript;
upstream backend {        ip_hash;        server 127.0.0.1:8080; # IP goes here.    }


This is my nginx's virtual host config:
server {        listen xxxx.xxxx.xxx.xx:80; # IP goes here.        server_name www.domain.com; # IP could go here.
# Set proxy headers for the passthrough        proxy_set_header Host $host;        proxy_set_header X-Real-IP $remote_addr;        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;       # Let the Set-Cookie header through.        proxy_pass_header Set-Cookie;
# Max upload size: make sure this matches the php.ini in .htaccess        client_max_body_size 8m;
# Catch the wordpress cookies.        # Must be set to blank first for when they don't exist.        set $wordpress_auth "";        if ($http_cookie ~* "wordpress_logged_in_[^=]*=([^%]+)%7C") {            set $wordpress_auth wordpress_logged_in_$1;        }
# Set the proxy cache key        set $cache_key $scheme$host$uri$is_args$args;
# All media (including uploaded) is under wp-content/ so# instead of caching the response from apache, we're just# going to use nginx to serve directly from there.        location ~* ^/(wp-content|wp-includes)/(.*)\.(gif|jpg|jpeg|png|ico|bmp|js|css|pdf|doc)$ {            root /home/domain.com;        }
# Don't cache these pages.        location ~* ^/(wp-admin|wp-login.php){            proxy_pass http://backend;        }
location / {            proxy_pass http://backend;            proxy_cache main;            proxy_cache_key $cache_key;            proxy_cache_valid 30m; # 200, 301 and 302 will be cached.            proxy_cache_use_stale error                                  timeout                                  invalid_header                                  http_500                                  http_502                                  http_504                                  http_404;            # 2 rules to dedicate the no caching rule for logged in users.            proxy_cache_bypass $wordpress_auth; # Do not cache the response.            proxy_no_cache $wordpress_auth; # Do not serve response from cache.            proxy_buffers 8 2m;            proxy_buffer_size 10m;            proxy_busy_buffers_size 10m;        }
    }} 
Thank you very much
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20160705/a83e1a5d/attachment.html>


More information about the nginx mailing list