Clearing nginx proxy cache manually

운영중인 nginx에 캐시 설정이 되어있을 때, 해당 캐시 데이터를 퍼지(삭제) 시키고 싶을 경우

 

1. Find proxy_cache_path settings on nginx configuration.
nginx 설정 파일 (nginx.conf 등의 설정 파일)내의 proxy_cache_path 설정 부분을 찾아 변경해 준다.

# Example
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=edge-cache:10m inactive=600m max_size=1g;

2. Remove the files or directory under the configured cache path.
해당 디렉토리 내의 내용물들을 삭제해 준다. (예제의 경우 /var/cache/nginx 하위의 모든 데이터)

3. Reload nginx

nginx -s reload

PS. If you using nginx+, just curl with PURGE.
만약, NGINX+를 사용하고 있다면 curl 또는 wget 등을 이용해 PURGE 메소드를 날려준다.

curl -H -X PURGE [URL]

 

'System Engineering > Linux' 카테고리의 다른 글

bash] system check  (0) 2022.03.28
KVM virtual machine setting  (0) 2020.06.26
Ubuntu apt-get upgrade  (0) 2019.12.13
Logstash - filebeat SSL settings  (0) 2019.11.26
Buffers and cache in memory (Linux)  (0) 2019.11.11

+ Recent posts