I’ve used nginx quite a lot – so if you need any pointers feel free to ask
Here’s some extra config which I use in one of my sites in case you’re interested. It utilises front end caching for cfm pages based on JSESSIONID (so user specific caching), and then non-user specific caching for static files.
define two local caches.
proxy_cache_path /var/lib/nginx/staticcache levels=1:2 keys_zone=staticfilecache:1024m max_size=40g inactive=7d;
proxy_cache_path /var/lib/nginx/websitecache levels=1:2 keys_zone=websitecache:1024m max_size=40g inactive=1d;
server {
listen 80; ## listen for ipv4
server_name mywebsite.com; ## myserver name
index index.cfm; ## index page
gzip_vary on; ## enable gzip
gzip_static on;
location / {
if (!-f $request_filename) {
rewrite ^/(.*)$ /website/index.cfm/$1 break; ## rewrite all requests – for pure SES.
break;
}
proxy_pass http://127.0.0.1:8080/website/; ## pass all to this context root
proxy_cache websitecache; ## specific the cache to use for this location
proxy_cache_valid 200 302 1d; ## specify a cache timeout for the reponse code
proxy_cache_valid 307 404 500 400 1m; ## only cache these temporarily
proxy_cache_key “$scheme$host$request_method$request_uri$cookie_JSESSIONID”; ## the key for caching requests
proxy_cache_bypass $cookie_isAdmin; ## never cache administrators
proxy_no_cache $cookie_isAdmin; ## never cache administrators
access_log /var/log/nginx/cache.log cache; ## log cache requests to a cache log
}
location /includes {
root /usr/share/tomcat6/webapps/website/;
proxy_cache staticfilecache; ## specify the cache to use for this location
proxy_cache_valid 200 302 7d; ## specify a cache timeout for the reponse code
proxy_cache_valid 307 404 500 400 1m; ## only cache these temporarily
proxy_ignore_headers Set-Cookie; ## ignore cookie data for this cache
add_header Cache-Control “public, max-age=315360000”; ## set some headers for client side caching
expires max;
}
}