사용자 도구

사이트 도구


nginx:proxy_cache

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
nginx:proxy_cache [2012/10/26 12:11]
kwon37xi
nginx:proxy_cache [2015/06/30 09:59] (현재)
kwon37xi
줄 1: 줄 1:
 ====== nginx Proxy Cache ====== ====== nginx Proxy Cache ======
-  * 정적 데이터를 캐싱할 수 있다.+  * 다른 서버에서 오는 정적 데이터를 캐싱할 수 있다. 
 +  * [[http://www.slideshare.net/Nginx/nginx-highperformance-caching|NGINX High-performance Caching]]
   * Cache를 비롯한 Shared 메모리를 사용하는 기능은 Windows Vista 이후 버전에서는 작동하지 않는다. [[http://nginx.org/en/docs/windows.html#known_issues|nginx Windows known issues]]   * Cache를 비롯한 Shared 메모리를 사용하는 기능은 Windows Vista 이후 버전에서는 작동하지 않는다. [[http://nginx.org/en/docs/windows.html#known_issues|nginx Windows known issues]]
   * 기본적으로 응답의 헤더를 분석하여 캐시 관련 헤더의 값에 따라 캐싱을 수행한다. 즉, proxy 서버 전체에 대해 캐시를 걸더라도 응답 헤더에서 cache를 하도록 하지 않았다면 캐시를 수행하지 않는다.   * 기본적으로 응답의 헤더를 분석하여 캐시 관련 헤더의 값에 따라 캐싱을 수행한다. 즉, proxy 서버 전체에 대해 캐시를 걸더라도 응답 헤더에서 cache를 하도록 하지 않았다면 캐시를 수행하지 않는다.
줄 7: 줄 8:
   tmpfs  /var/lib/nginx tmpfs size=50M,uid=33    0       0   tmpfs  /var/lib/nginx tmpfs size=50M,uid=33    0       0
 </code> </code>
 +    * 일반적인 리눅스 배포판들은 ''/dev/shm''을 램디스크 파티션으로 만들어둔 상태이다.
   * [[http://wiki.nginx.org/HttpProxyModule#proxy_cache_path|proxy_cache_path]] 설정시 ''max_size''를 캐시를 저장할 파일 시스템보다 작게 지정한다.<code>   * [[http://wiki.nginx.org/HttpProxyModule#proxy_cache_path|proxy_cache_path]] 설정시 ''max_size''를 캐시를 저장할 파일 시스템보다 작게 지정한다.<code>
-proxy_cache_path  /var/lib/nginx/cache  levels=1: keys_zone=adams:10m max_size=45m;+proxy_cache_path  /var/lib/nginx/cache  levels=1: keys_zone=adams:10m max_size=2048m;
 </code> </code>
   * [[http://syslog.tv/2010/02/14/more-nginx-proxy_cache-optimizations-and-nginx-load-balancing/|More nginx proxy_cache optimizations and nginx load balancing]]   * [[http://syslog.tv/2010/02/14/more-nginx-proxy_cache-optimizations-and-nginx-load-balancing/|More nginx proxy_cache optimizations and nginx load balancing]]
   * [[http://www.goitworld.com/how-to-use-nginx-proxy-cache-replace-squid/|How To use nginx proxy cache replace squid]]   * [[http://www.goitworld.com/how-to-use-nginx-proxy-cache-replace-squid/|How To use nginx proxy cache replace squid]]
 +  * [[http://www.rfxn.com/nginx-caching-proxy/|Nginx: Caching Proxy | R-fx Networks]]
  
 +===== 기본 설정 =====
 <code> <code>
-proxy_cache+http { 
 +  proxy_cache_path /tmp/nginx_cache levels=1:2 keys_zone=cache:8m max_size=1000m; 
 +  proxy_temp_path /tmp/nginx_cache/tmp; 
 +  server { 
 +    proxy_cache cache; 
 +  } 
 +}
 </code> </code>
 +
 +===== 로컬 파일 캐시 =====
 +  * [[http://labs.frickle.com/nginx_ngx_slowfs_cache|ngx_slowfs_cache]]
 +  * nginx는 기본적으로 로컬 파일 캐싱을 지원하지 않고 있다. 그러나 서빙중인 파일이 NFS등의 네트워크로 연결된 파일 시스템 상에 있을 때 캐시를 하는 것이 부담을 줄여준다.
 +
nginx/proxy_cache.1351221097.txt.gz · 마지막으로 수정됨: 2012/10/26 12:11 저자 kwon37xi