Closed pokal4u closed 10 years ago
Hi I am using nginx push strem module with long pooling
gzip is not working
my config file
pid logs/nginx.pid; error_log logs/nginx-main_error.log debug;
master_process off; daemon off; worker_rlimit_core 500M; working_directory /tmp/nginx;
worker_processes 2;
events { worker_connections 1024; use epoll; }
http {
index index.php index.htm index.html .php; include /usr/local/nginx/conf/mime.types; default_type application/octet-stream; access_log logs/nginx-http_access.log; error_log logs/nginx-http_error.log debug; tcp_nopush off; tcp_nodelay on; keepalive_timeout 10; send_timeout 10; client_body_timeout 10; client_header_timeout 10; sendfile on; client_header_buffer_size 1k; large_client_header_buffers 2 4k; #client_max_body_size 1k; #client_body_buffer_size 1k; ignore_invalid_headers on; push_stream_shared_memory_size 500m; push_stream_max_channel_id_length 200; # max messages to store in memory push_stream_max_messages_stored_per_channel 1000; # message ttl push_stream_message_ttl 10m; # ping frequency push_stream_ping_message_interval 10s; # connection ttl to enable recycle push_stream_subscriber_connection_ttl 15m; # connection ttl for long polling push_stream_longpolling_connection_ttl 5m; # broadcast push_stream_broadcast_channel_prefix "broad_"; #push_stream_message_template "{\"id\":~id~,\"channel\":\"~channel~\",\"text\":\"~text~\",\"eventid\":\"~event-id~\"}"; push_stream_message_template "{\"id\":~id~,\"channel\":\"~channel~\",\"text\":\"~text~\"}"; # subscriber may create channels on demand or only authorized # (publisher) may do it? push_stream_authorized_channels_only off; push_stream_broadcast_channel_max_qtd 3; client_max_body_size 3M; client_body_buffer_size 3M; gzip on; #gzip_static on; gzip_buffers 16 4k; gzip_proxied any; gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript; gzip_comp_level 9; gzip_http_version 1.0; #proxy_set_header Accept-Encoding ""; server { listen 80 default_server; #listen 9443 ssl; #ssl on; #ssl_certificate /usr/local/nginx/ssl/server.crt; #ssl_certificate_key /usr/local/nginx/ssl/server.key; server_name localhost; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; location ~* \.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)?$ { expires 1M; access_log off; add_header Cache-Control "public"; add_header Cache-Control "must-revalidate"; #add_header Content-Encoding deflate; } location /channels-stats { # activate channels statistics mode for this location push_stream_channels_statistics; # query string based channel id set $push_stream_channel_id $arg_id; } location @backend { internal; proxy_pass http://localhost:8080; #include proxy.inc; # Refer step 9 } location ~ .*\.(php|jsp|cgi|pl|py|dat)?$ { proxy_pass http://localhost:8080; #include proxy.inc; # Refer step 9 } location ~ \.php$ { include /usr/local/nginx/conf/fastcgi_params; fastcgi_pass localhost:8080; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /usr/html$fastcgi_script_name; fastcgi_param HTTPS on; } location /pub { # activate publisher mode for this location, with admin support push_stream_publisher admin; # query string based channel id set $push_stream_channel_id $arg_id; # store messages in memory push_stream_store_messages on; push_stream_keepalive on; # Message size limit # client_max_body_size MUST be equal to client_body_buffer_size or # you will be sorry. #client_max_body_size 32k; #client_body_buffer_size 32k; } location ~ /sub/(.*) { # activate subscriber mode for this location push_stream_subscriber; # positional channel path set $push_stream_channels_path $1; # header to be sent when receiving new subscriber connection push_stream_header_template "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n<meta http-equiv=\"Cache-Control\" content=\"no-store\">\r\n<meta http-equiv=\"Cache-Control\" content=\"no-cache\">\r\n<meta http-equiv=\"Pragma\" content=\"no-cache\">\r\n<meta http-equiv=\"Expires\" content=\"Thu, 1 Jan 1970 00:00:00 GMT\">\r\n<script type=\"text/javascript\">\r\nwindow.onError = null;\r\ntry{ document.domain = (window.location.hostname.match(/^(\d{1,3}\.){3}\d{1,3}$/)) ? window.location.hostname : window.location.hostname.split('.').slice(-2).join('.');}catch(e){}\r\nparent.PushStream.register(this);\r\n</script>\r\n</head>\r\n<body>"; # message template #push_stream_message_template "<script>p(~id~,'~channel~','~text~','~event-id~');</script>"; push_stream_message_template "<script>p(~id~,'~channel~','~text~');</script>"; # footer to be sent when finishing subscriber connection push_stream_footer_template "</body></html>"; # content-type push_stream_content_type "text/html; charset=utf-8"; } location ~ /ev/(.*) { # activate subscriber mode for this location push_stream_subscriber; # positional channel path set $push_stream_channels_path $1; # activate event source support for this location push_stream_eventsource_support on; } location ~ /lp/(.*) { # activate long-polling mode for this location push_stream_subscriber long-polling; # positional channel path set $push_stream_channels_path $1; } location ~ /ws/(.*) { # activate websocket mode for this location push_stream_websocket; # positional channel path set $push_stream_channels_path $1; # store messages in memory push_stream_store_messages on; push_stream_websocket_allow_publish on; } }
}
This was solved on tag 0.4.0 3d3a204177d3a7ab8a2858e04e792a6d11bf133f
Hi I am using nginx push strem module with long pooling
gzip is not working
my config file
pid logs/nginx.pid; error_log logs/nginx-main_error.log debug;
Development Mode
master_process off; daemon off; worker_rlimit_core 500M; working_directory /tmp/nginx;
worker_processes 2;
events { worker_connections 1024; use epoll; }
http {
}