Добрый день.
Что-то у меня не сходится, не понимаю:
Запрос в 22/May/2019:17:15:43
Файл элемента кеша создан May 18 12:46
inactive=1d
ответ 302
proxy_cache_valid 301 302 404 15s;
Более подробно:
В логе запрос с попаданием в кеш
[22/May/2019:17:15:43 +0300] "/s13/27/public_pin_l/241/2352410650.jpg"
ip=15.85.172.17 status=302 size=0 upTime=- upstream_addr=-
upstream_status=- request_time=0.000 cache=HIT ref="-" http
Вычисляем файл кеша:
echo -n /s13/27/public_pin_l/241/2352410650.jpg | md5sum
044e2e2e9226a8f10d25d480a49d2000
Вот он
-rw--- 1 www-data www-data 684 May 18 12:46
044e2e2e9226a8f10d25d480a49d2000
Содержит он
cat 044e2e2e9226a8f10d25d480a49d2000
ђa]ђФЯ\ТYЁK~¬
KEY: /s13/27/public_pin_l/241/2352410650.jpg
HTTP/1.1 302 Found
Server: nginx/1.15.8
Date: Sat, 18 May 2019 09:46:56 GMT
Content-Length: 0
Connection: close
Cache-Control: max-age=2592000
Expires: Mon, 17 Jun 2019 09:46:56 GMT
Location: /s107/797257fdf5bc88f5/2352410650.jpg
Pragma: no-cache
X-Powered: iconv
Content-Type: image/jpeg
Конфиг вот такой:
user www-data;
worker_processes auto;
worker_rlimit_nofile 16;
thread_pool pool_1 threads=128;
thread_pool pool_2 threads=128;
error_log /var/log/nginx/error.log warn;
events {
worker_connections 15;
use epoll;
}
http {
server_tokens off;
include mime.types;
default_type application/octet-stream;
log_format stat'[$time_local] "$request_uri" ip=$remote_addr
status=$status size=$body_bytes_sent upTime=$upstream_response_time
upstream_addr=$upstream_addr upstream_status=$upstream_status'
' request_time=$request_time
cache=$upstream_cache_status ref="$http_referer" $scheme $http2';
log_not_found off;
sendfile on;
tcp_nopush on;
keepalive_timeout 300;
gzip off;
reset_timedout_connection on;
client_body_buffer_size 128k;
client_max_body_size20m;
open_file_cache max=1 inactive=5m;
open_file_cache_valid2m;
open_file_cache_min_uses 1;
open_file_cache_errors on;
proxy_temp_path /run/shm;
proxy_cache_key $uri$is_args$args;
proxy_cache_valid 200 30d;
proxy_cache_valid 301 302 404 15s;
proxy_cache_lock off;
proxy_cache_use_stale error timeout invalid_header http_500
http_502 http_503 http_504 http_404;
proxy_redirectoff;
recursive_error_pages on;
proxy_buffers 16 16k;
proxy_buffer_size 64k;
proxy_ignore_client_abort off;
proxy_intercept_errorson;
proxy_next_upstream error timeout invalid_header http_500
http_502 http_503 http_504 http_404;
proxy_set_header Host$host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
proxy_max_temp_file_size 0;
include upstream/upstream_cache.conf;
include upstream/upstream_storage.conf;
include upstream/all_in_one_storage_upstream.conf;
include nginx.ssl.conf;
proxy_cache_path /ssd levels=1:2 keys_zone=ssd1:2000m
max_size=175000m inactive=1d loader_files=1000 use_temp_path=off;
proxy_cache_path /ssd2levels=1:2 keys_zone=ssd2:2000m
max_size=205000m inactive=1d loader_files=1000 use_temp_path=off;
split_clients $uri$is_args$args $disk {
56.3% 2;
* 1;
}
aio threads=pool_$disk;
proxy_cache ssd$disk;
server {
server_name 8.local.net;
listen 80 backlog=102400 default;
listen 443 backlog=102400 ssl http2 default;
root /etc/nginx/html;
access_log /var/log/nginx/access_basic.log stat;
location / {
try_files $uri @to_neighbor;
}
location = /error404.html {
return 404 "No such file";
}
location @to_neighbor {
internal;
access_log /var/log/nginx/access_full.log stat;
proxy_pass http://cache_$real_host;
error_page 400 /error404.html;
error_page 404 = @to_storage;
error_page 502 = @to_storage;
error_page 504 = @to_storage;
error_page 503 = @to_storage;
}
location @to_storage {
if ( $request_method = PURGE ) { return 200; }
internal;
access_log /var/log/nginx/access_full.log stat;
access_log /var/log/nginx/access_stat.log stat if=$do_log;
include logs.inc;
proxy_pass http://all-storages;
error_page 400 /error404.html;
}
}
} # end of http
вт, 21 мая 2019 г. в 17:22, Maxim Dounin :
> Hello!
>
> On Tue, May 21, 2019 at 04:31:46PM +0300, kpoxa wrote:
>
> > Есть некоторые директивы, про которые не совсем понятно, как они работают
> > вместе, в частности у proxy_cache_path есть парам