Welcome! Log In Create A New Profile

Advanced

RE: proxy_cache ramdisk

February 01, 2010 11:04AM
-----Original Message-----
From: Ryan Malayter [mailto:malayter@gmail.com]
Sent: Monday, February 01, 2010 8:14 AM
To: nginx@nginx.org
Subject: Re: proxy_cache ramdisk

On Sun, Jan 31, 2010 at 9:12 PM, quan nexthop <quan.nexthop@gmail.com> wrote:
> Could you please share us your configuration ?

The basics of tmpfs are here: http://en.wikipedia.org/wiki/Tmpfs

Here's my config with most comments and white-space trimmed out:
________________________________________
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

events {
worker_connections 1024;
}

http {
include /etc/nginx/mime.types;
access_log /var/log/nginx/access.log;
sendfile on;
keepalive_timeout 65;
tcp_nodelay on;
gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip_proxied any;
gzip_http_version 1.0;
gzip_types text/plain text/xml text/css text/javascript
application/x-javascript;
gzip_buffers 8 32k;
gzip_comp_level 2;
#put nginx cache files into tmpfs ram disk that is backed by swap
proxy_cache_path /tmp/nginx_cache
levels=1:2
keys_zone=zone1:10m
inactive=7d
max_size=128m;

upstream backend {
ip_hash;
server 10.204.122.137;
server 10.224.122.138;
}

server {
listen 80;
server_name_in_redirect off;
#normalize all accept-encoding headers to just gzip or empty string
set $myae "";
if ($http_accept_encoding ~* gzip) {set $myae "gzip";}
#get rid of accept-encoding header for known-compressed file types
#we only want to store one version of these files in cache
if ($uri ~* \.(gif|jpg|jpeg|png|pdf|swf|flv|mp3|mp4|wmv)$) {set $myae "";}
access_log /var/log/nginx/localhost.access.log;

location / {
proxy_pass http://backend;
proxy_set_header Host $host;
proxy_set_header Accept-Encoding $myae;
proxy_read_timeout 900;
proxy_redirect default;
proxy_cache zone1;
proxy_cache_valid 200 301 302 1m;
proxy_cache_key "$host$request_uri$myae";
}
}

_______________________________________________


Thanks!!!!

So this is only caching gif|jpg|jpeg|png|pdf|swf|flv|mp3|mp4|wmv? That's almost exactly what I want.

Upstream backend is the ip address of what nginx is running on? This box has 4 IPs for 4 different sites, should I list them all in upstream backend?


_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

proxy_cache ramdisk

testbot January 29, 2010 11:48AM

RE: proxy_cache ramdisk

testbot January 30, 2010 01:50PM

RE: proxy_cache ramdisk

testbot January 31, 2010 05:30PM

Re: proxy_cache ramdisk

Igor Sysoev February 01, 2010 11:40AM

RE: proxy_cache ramdisk

testbot February 01, 2010 11:54AM

Re: proxy_cache ramdisk

Igor Sysoev February 01, 2010 12:10PM

RE: proxy_cache ramdisk

testbot February 01, 2010 12:30PM

Re: proxy_cache ramdisk

Igor Sysoev February 01, 2010 12:40PM

Re: proxy_cache ramdisk

Ryan Malayter February 02, 2010 09:48AM

RE: proxy_cache ramdisk

testbot February 02, 2010 12:58PM

Re: proxy_cache ramdisk

Ryan Malayter January 31, 2010 10:08PM

Re: proxy_cache ramdisk

nexthop January 31, 2010 10:14PM

Re: proxy_cache ramdisk

Ryan Malayter February 01, 2010 09:20AM

RE: proxy_cache ramdisk

testbot February 01, 2010 11:04AM

Re: proxy_cache ramdisk

Ryan Malayter February 01, 2010 05:50PM

RE: proxy_cache ramdisk

testbot February 01, 2010 11:10AM

RE: proxy_cache ramdisk

danny February 01, 2010 11:22AM

Re: proxy_cache ramdisk

Akins, Brian February 01, 2010 08:04AM

Re: proxy_cache ramdisk

Igor Sysoev February 01, 2010 11:42AM

Re: proxy_cache ramdisk

nexthop February 01, 2010 12:24PM

Re: proxy_cache ramdisk

Igor Sysoev February 01, 2010 12:36PM

Re: proxy_cache ramdisk

nexthop February 01, 2010 08:58PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 235
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready