Apply by doing:
       cd /usr/src
       patch -p0 < 004_nginx.patch

And then rebuild and install nginx:
       cd usr.sbin/nginx/
       make -f Makefile.bsd-wrapper obj
       make -f Makefile.bsd-wrapper depend
       make -f Makefile.bsd-wrapper
       make -f Makefile.bsd-wrapper install

Index: usr.sbin/nginx/src/http/modules/ngx_http_proxy_module.c
===================================================================
RCS file: /cvs/src/usr.sbin/nginx/src/http/modules/ngx_http_proxy_module.c,v
retrieving revision 1.7
diff -p -u -r1.7 ngx_http_proxy_module.c
--- usr.sbin/nginx/src/http/modules/ngx_http_proxy_module.c     13 May 2012 09:14:58 -0000      1.7
+++ usr.sbin/nginx/src/http/modules/ngx_http_proxy_module.c     16 May 2013 06:49:33 -0000
@@ -1864,6 +1864,10 @@ data:

    }

+    if (ctx->size < 0 || ctx->length < 0) {
+        goto invalid;
+    }
+
    return rc;

done: