Welcome! Log In Create A New Profile


Re: nginx as front end cache for WMS

March 04, 2014 07:34PM
Hi Anton,

I followed your suggestion and modified my conf files. I also added some new
stuff but still could not get it to work. I did not see any message written to the access log and did not see anything written to the cache. I included my new conf files and a request/response block that I captured using FireFox Live Http Headers addon. I hope someone can catch my mistake and show me what was wrong.

user vriuser;
worker_processes 4;
pid /var/run/nginx.pid;

events {
worker_connections 768;

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;

log_format geoserver-cache '$remote_addr - $upstream_cache_status [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

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

proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
add_header X-Cache $upstream_cache_status;

proxy_connect_timeout 60;
proxy_read_timeout 90;
proxy_send_timeout 60;

proxy_buffering on;
proxy_buffer_size 8k;
proxy_buffers 100 8k;

upstream backend {
server localhost;

proxy_cache_path /var/geoserver/cache levels=1:2 keys_zone=geoserver-cache:10m inactive=7d max_size=5000m;
proxy_temp_path /var/geoserver/cache/tmp;

server {
listen 80;
#server_name localhost;
#root /home/geoserver/webapps/geoserver;
root /opt/tomcat/webapps/geoserver;

proxy_redirect off;
proxy_buffering on;
proxy_cache_valid any 7d;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
access_log /var/log/nginx/geoserver/access.log geoserver-cache;
error_log /var/log/nginx/geoserver/error.log;

proxy_cache geoserver-cache;
proxy_cache_valid 200 2h;
proxy_cache_valid 302 2h;
proxy_cache_valid 301 4h;
proxy_cache_valid any 1m;

location / {
proxy_pass http://backend;
proxy_cache_key $scheme://backend:8080/$request_uri;
proxy_cache_valid 200;

Request/Response headers:


GET /geoserver/osm/wms?LAYERS=Florida&STYLES=&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&SRS=EPSG%3A3857&BBOX=-9046077.9720712,3223712.9634365,-9032807.336146,3240204.627499&WIDTH=412&HEIGHT=512 HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0
Accept: image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://localhost:8080/geoserver/osm/wms?service=WMS&version=1.1.0&request=GetMap&layers=Florida&styles=&bbox=-9735065.0,2733130.75,-8885187.0,3788597.25&width=412&height=512&srs=EPSG:3857&format=application/openlayers
Cookie: JSESSIONID=BDE023A90406794200BCF412045BC96C; JSESSIONID=maqv107kg0me
Connection: keep-alive

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Disposition: inline; filename=Florida.png
Content-Type: image/png
Transfer-Encoding: chunked
Date: Wed, 05 Mar 2014 00:15:35 GMT

Subject Author Posted

nginx as front end cache for WMS

tt5430 March 03, 2014 05:26PM

Re: nginx as front end cache for WMS

Anton Yuzhaninov March 04, 2014 05:24AM

Re: nginx as front end cache for WMS

tt5430 March 04, 2014 07:34PM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 87
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 185 on January 31, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready