suddenly my configuration is not caching
April 27, 2020 08:18PM
Hello I Had this configuration for many time, and it worked fine, it showed me HIT in the logs, but after adding
these parameters and restart the service now I only have MISS and it is not caching anything.

parameter add:
large_client_header_buffers 8 64k;
client_body_buffer_size 32k;
client_header_buffer_size 8k;

my config is:

# Log format caching
log_format cache '"***$time_local ' '"$http_x_forwarded_for ' '"$remote_addr ' '"req_time=$request_time '
'"$upstream_cache_status ' '"Cache-Control: $upstream_http_cache_control '
'Expires: $upstream_http_expires ' '"$request "($status) ' '"$http_user_agent" ';

server {

listen 80;

# Logging
access_log /var/log/nginx/xxx-access.log cache;
error_log /var/log/nginx/xxxx-error.log error;

#large_client_header_buffers 4 16k; -->before
large_client_header_buffers 8 64k; --->after
client_body_buffer_size 32k;
client_header_buffer_size 8k;

location / {

proxy_cache web-cache; -->declared in file nginx.conf
proxy_cache_key "cache_3$host$uri";

proxy_send_timeout 30;
proxy_read_timeout 30;

proxy_http_version 1.1;
proxy_set_header Connection "";

proxy_set_header Host $host;
proxy_pass xxxxxx;
proxy_cache_valid 5m;
expires 10m;
proxy_cache_valid 502 503 2s;
proxy_cache_revalidate off;
proxy_cache_methods GET HEAD;
proxy_ignore_headers Cache-Control Expires X-Accel-Expires Vary Set-Cookie;
proxy_cache_min_uses 1;
proxy_cache_background_update on;
proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
proxy_cache_lock on;
proxy_cache_lock_age 5s;
proxy_cache_bypass $arg_bypasscache;
add_header x-cache-status $upstream_cache_status;
add_header x-cache-key "$host$uri";
#add_header X-Frame-Options SAMEORIGIN;

location /envivo/(.*) {
expires 120m;
proxy_cache web-cache;
proxy_pass xxxxxxx;
# #access_log on;

location ~ \.php$ {

proxy_pass xxxx;

location @backend {
# essentially the same as passing php requests back to apache
proxy_pass xxxx;

location ~ /\.ht {
deny all;

location /nginx_status {
allow; #only allow requests from localhost
deny all; #deny all other hosts

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 50
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