nginx 07 - Nginx 캐 시 서비스
proxy_cache_path path kes_zone=name:size
[levels=levels]
[use_temp_path=on|off]
[inactive=time]
[max_size=size]
[manager_files=number]
[manager_sleep=time]
[manager_threshold=time]
[loader_files=number]
[loader_sleep=time]
[loader_threshold=time]
[purger=on|off]
[purger_files=number]
[purger_sleep=time]
[purger_threshold=time]
(http)
proxy_cache zone|off;
(http、server、location)
proxy_cache_valid [code..] time;
(http、server、location)
:
proxy_cache_key string;
(http、server、location)
: , :proxy_cache_key $scheme$proxy_host$request_uri
Nginx 캐 시 서비스 설정 사례
http{
upstream test {
server 192.168.10.10:8080 down;
server 192.168.10.10:8081 max_fails=1 fail_timeout=10s;
server 192.168.10.11:8080 backup;
}
proxy_cache_path /opt/app/cache levels=1:2 keys_zone=imooc_cache:10m max_size=10g inactive=60m use_temp_path=off;
server {
listen 80;
server_name location;
location / {
proxy_cache off;
proxy_pass http://test;
proxy_cache_valid 200 304 12h;
proxy_cache_valid any 10m;
proxy_cache_key $host$uri$is_args$args;
add_header Nginx-Cache "$upstream_cache_status";
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
}
}
}
지정 한 캐 시 를 어떻게 청소 합 니까?
일부 페이지 가 캐 시 되 지 않도록 하 는 방법
proxy_no-cache string ...;
(http、server、location)
server {
listen 80;
server_name location;
if ($request_uri ~ ^/(url3|login|register|password\/reset)) {
set $cookie_nocche 1;
}
location / {
proxy_cache off;
proxy_pass http://test;
proxy_cache_valid 200 304 12h;
proxy_cache_valid any 10m;
proxy_cache_key $host$uri$is_args$args;
proxy_no_cache $cookie_nocche $arg_nocache $arg_comment;
proxy_no_cache $http_pragma $http_authorization;
add_header Nginx-Cache "$upstream_cache_status";
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
}
}
큰 파일 분할 요청
slice size;
(http、server、location) :slice 0
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.