 
#user  nobody;
worker_processes 20;
working_directory /tmp;

worker_rlimit_core  1024M;
worker_rlimit_nofile 100000;
#debug_points stop;

#error_log  /dev/stderr debug;
error_log  /dev/stderr  notice;
#error_log   err.log  notice;

pid        /tmp/pushmodule-test-nginx.pid;
daemon	    off;

events {
  worker_connections  10000;
  accept_mutex off;
}

http {
  access_log /dev/stdout;
#  access_log /dev/stdout;
  default_type  application/octet-stream;
  client_body_temp_path /tmp/ 1 2;
  sendfile        on;
  keepalive_timeout  65;
  push_authorized_channels_only off;
  push_max_reserved_memory 32M;
  #cachetag

  server {
    listen       8082;
#    root ./;
    location ~ /pub/(\w+)$ {
      set $push_channel_id $1;
      push_publisher;
      push_min_message_buffer_length 5;
      push_max_message_buffer_length 20;
      push_message_timeout 5s;
      push_channel_group test;
    }

    location ~/pub/nobuffer/(\w+)$ {
      set $push_channel_id $1;
      push_publisher;
      push_store_messages off;
      push_message_timeout 60s;
      push_channel_group test;
    }

    location ~ /pub/2_sec_message_timeout/(\w+)$ {
      set $push_channel_id $1;
      push_publisher;
      push_min_message_buffer_length 5;
      push_max_message_buffer_length 20;
      push_message_timeout 2s;
      push_channel_group test;
    }

    location ~ /sub/broadcast/(\w+)$ {
      push_subscriber;
      push_channel_group test;
      set $push_channel_id $1;
      push_subscriber_concurrency broadcast;
    }
    location ~ /sub/first/(\w+)$ {
      push_subscriber;
      push_channel_group test;
      set $push_channel_id $1;
      push_subscriber_concurrency first;
    }
    location ~ /sub/last/(\w+)$ {
      push_subscriber;
      push_channel_group test;
      set $push_channel_id $1;
      push_subscriber_concurrency last;
    }
    location ~ /sub/intervalpoll/(\w+)$ {
      push_subscriber interval-poll;
      push_channel_group test;
      set $push_channel_id $1;
      push_subscriber_concurrency broadcast;
    }

    location ~ /sub/gzip/(\w+)$ {
      add_header Content-Type text/plain;
      gzip on;
      gzip_min_length 10;
      gzip_proxied any;
      gzip_types *;
      push_subscriber;
      push_channel_group test;
      set $push_channel_id $1;
      push_subscriber_concurrency broadcast;
    }

    #quick subscriber timeout
    location ~ /sub/timeout/(\w+)$ {
      push_subscriber;
      push_channel_group test;
      set $push_channel_id $1;
      push_subscriber_concurrency broadcast;
      push_subscriber_timeout 2s;
    }

    #authorized channels only -- publishers must create the channel before subscribing
    location ~ /sub/authorized/(\w+)$ {
      push_authorized_channels_only on;
      push_subscriber;
      push_channel_group test;
      set $push_channel_id $1;
    }

    location ~ /rewrite/(.*)$ {
      rewrite  ^/(.*)$  $1;
    }

  }
}
