nginx as front end cache for WMS

tt5430 nginx-forum at nginx.us
Mon Mar 3 22:26:55 UTC 2014


I tried to set up nginx as a front end cache for my WMS server.  The typical
WMS request is:
http://localhost:8080/geoserver/somestring/wms?version=1.1.1&service=WMS&request=WMS&....
Below is my nginx configuration:

/etc/nginx/nginx.conf:
user vriuser;
worker_processes 4;
pid /var/run/nginx.pid;

events {
        worker_connections 768;
        # multi_accept on;
}

http {
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
  
        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        proxy_buffering           on;
        proxy_cache_valid         any 10m;
        proxy_cache_path          /var/geoserver/cache  levels=1:2
keys_zone=one:10m inactive=7d max_size=5000m;
        proxy_temp_path           /var/geoserver/cache/tmp;

        gzip on;
        gzip_disable "msie6";

        # gzip_vary on;
        gzip on;
        gzip_disable "msie6";

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}

/etc/nginx/sites-enabled/geoserver.conf
server {
        listen       80;
        #server_name  localhost;
        root         /home/geoserver/webapps/geoserver;

        location /geoserver {
            proxy_pass   http://localhost:8080;
            proxy_cache             one;
            proxy_cache_key         backend$request_uri;
            proxy_cache_valid       200  5h;
            proxy_cache_use_stale   error timeout invalid_header;
        }
}

Both nginx and my WMS servers were running without errror.  However, when I
inspect the /var/geoserver/cache directory, I did not see anything file in
there.  Does it mean my configuration is not correct?  How do I know if
nginx caches my WMS responses?  Any help on this is greatly appreciated.

Many thanks in advance.

Regards, 
Tam

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



More information about the nginx mailing list