performance issus, please help???

magicbear nginx-forum at nginx.us
Mon Aug 29 08:02:35 UTC 2011


If your page can using cache, you can try proxy_cache.
And static file don't fallback to Apache, direct using nginx to
process.

Example config:
proxy_cache_path /var/www/cdn_cache  levels=1:2  
keys_zone=cachedata:128m max_size=4096m;

upstream backend {
	server 127.0.0.1:9000 weight=3 fail_timeout=2s;
}

location ~ \.(gif|jpg|png|css|js|txt|xml)$
{
  root /path/to/web;
}

location ~ ^/view\.php$ {
		proxy_cache cachedata;
		proxy_cache_valid 200 304 60s;
		proxy_cache_key $uri$gzip$is_args$args;
		add_header X-Cache "$upstream_cache_status from $hostname";
		expires 60s;
		proxy_set_header X-REAL-IP $remote_addr;
		proxy_set_header Host $host;
		proxy_pass http://backend;
}

location / {
		proxy_pass http://backend;
}

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,214412,214416#msg-214416



More information about the nginx mailing list