Hi Alex/all, How did you fix?
I've got a very similar issue. nginx running Wordpress with the Hypercache plugin but only the homepage is cached, other pages "miss" according to page headers. Thanks, Jore On 24/5/20 7:04 am, Alex Evonosky wrote: > Disregard, found the issue. > > thank you. > > On Sat, May 23, 2020 at 4:18 PM Alex Evonosky <alex.evono...@gmail.com > <mailto:alex.evono...@gmail.com>> wrote: > > "Can you be more specific? Which "cache"? Browser cache? Nginx content > cache? try_files has nothing to do with caching..." > > > Nginx content cache > > > "Either way, you need to check your headers to ensure that they allow > caching for said pages. Also if any cookies are being sent then nginx > won't cache the page." > > > I looked at the headers using CURL.. > > The issue seems this: > > > The request hits NGINX and the backend server(s) for Wordpress are > cached just fine from just the FQDN --- example.com > <http://example.com> > > however, if I try to go to say, example.com/?page_id=1234 > <http://example.com/?page_id=1234>, the headers do not show NGINX > anymore, as only the servers for Wordpress show up; Almost like a > cache punch-hole. > > > ===== proxy.conf ==== > > proxy_cache_path /tmp/cache keys_zone=my_cache:10m max_size=10m > inactive=60m; > > #proxy_redirect off; > proxy_set_header Host $host; > proxy_set_header X-Real-IP $remote_addr; > proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; > add_header X-Cache-Status $upstream_cache_status; > client_max_body_size 10m; > client_body_buffer_size 128k; > proxy_connect_timeout 90; > proxy_send_timeout 90; > proxy_read_timeout 90; > proxy_buffers 32 4k; > > > > ==== nginx.conf ==== > > http { > upstream example.com <http://example.com> { > least_conn; > server 10.10.10.138:8999 <http://10.10.10.138:8999>; > server 10.10.10.84:8999 <http://10.10.10.84:8999>; > } > > server { > listen 82; > location / { > try_files $uri $uri/ /$args /index.php?$args; > proxy_cache my_cache; > proxy_cache_use_stale error timeout http_500 http_502 http_503 > http_504; > proxy_cache_background_update on; > proxy_pass http://example.com; > proxy_cache_valid any 60m; > proxy_cache_methods GET HEAD POST; > proxy_http_version 1.1; > proxy_set_header Connection keep-alive; > proxy_ignore_headers Cache-Control Expires Set-Cookie; > } > } > > sendfile on; > tcp_nopush on; > tcp_nodelay on; > keepalive_timeout 65; > types_hash_max_size 2048; > > gzip on; > gzip_disable "msie6"; > > # include /etc/nginx/conf.d/*.conf; > # include /etc/nginx/sites-enabled/*; > include /etc/nginx/proxy.conf; > > } > > > > > > Thank you, > Alex > > > > > On Sat, May 23, 2020 at 8:43 AM J.R. <themadbea...@gmail.com > <mailto:themadbea...@gmail.com>> wrote: > > > And the main page caches OK, but any page the resides on the > "?page_id" is > > not getting cached. Is there more to the "try_files" that > needs applied > > for caching of these permalinks? > > Can you be more specific? Which "cache"? Browser cache? Nginx > content > cache? try_files has nothing to do with caching... > > Either way, you need to check your headers to ensure that they > allow > caching for said pages. Also if any cookies are being sent > then nginx > won't cache the page. > _______________________________________________ > nginx mailing list > nginx@nginx.org <mailto:nginx@nginx.org> > http://mailman.nginx.org/mailman/listinfo/nginx > > > _______________________________________________ > nginx mailing list > nginx@nginx.org > http://mailman.nginx.org/mailman/listinfo/nginx
_______________________________________________ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx