Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Am I caching right? is there any way i can improve this? the site gets about 3k unique hits a day

nginx.conf:

 gzip_types    text/* application/* image/*;
 open_file_cache max=1000 inactive=20s;
 open_file_cache_valid    30s;
 open_file_cache_min_uses 2;
 open_file_cache_errors   off;
 if_modified_since before;
 proxy_cache_path /tmp/nginx/cache  levels=1:2 keys_zone=one:30m inactive=1d  max_size=500m;
 proxy_temp_path  /tmp/nginx/proxy;
 proxy_cache_key  "$scheme://$host$request_uri";

.

vhost file:

location / {
                set $memcached_key      $uri;
                memcached_pass          127.0.0.1:11000;
                proxy_cache             one;
                proxy_cache_key         "$scheme://$host$request_uri";
                proxy_cache_valid       200 302 1d;
                proxy_cache_valid       any 1m;
                proxy_cache_use_stale   error timeout invalid_header updating http_500 http_502 http_503 http_504;

          location ~.*\.(3gp|gif|jpg|jpeg|png|ico|wmv|avi|asf|asx|mpg|mpeg|mp4|pls|mp3|mid|wav|swf|flv|html|htm|txt|js|css|exe|zip|tar|rar|gz|tgz|bz2|uha|7z|doc|docx|xls|xlsx|pdf|iso)$ {
          expires 7d;
          proxy_cache             one;
          try_files $uri @backend;
          }
          location ~ .*\.(php|jsp|cgi|pl|py)?$ {
          proxy_pass http://ip.ip.ip.ip:8080;
          proxy_connect_timeout 30s;
proxy_send_timeout   90;
proxy_read_timeout   90;
proxy_buffer_size    64k;
proxy_buffers     16 32k;
proxy_busy_buffers_size 64k;
proxy_pass_header Set-Cookie;
proxy_redirect     off;
proxy_hide_header  Vary;
proxy_set_header   Accept-Encoding '';
proxy_ignore_headers Cache-Control Expires;
proxy_set_header   Referer $http_referer;
proxy_set_header   Host   $host;
proxy_set_header   Cookie $http_cookie;
proxy_set_header   X-Real-IP  $remote_addr;
proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
          }
share|improve this question
2  
At 3,000 hits per day, unless they all came within the space of 10 seconds or less, I personally wouldn't worry about adding the complexity of Nginx in front of Apache. I did have Nginx as proxy/LB in front of a couple of Apache servers, but that system was reaching ~24,000,000 hits/day. –  Alister Bulman Feb 20 '11 at 22:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.