Ticket #996: nginx.conf

File nginx.conf, 5.5 KB (added by enjoychange@…, 10 years ago)

please find the nginx configuration attached

Line 
1pid logs/nginx.pid;
2error_log logs/error.log info;
3
4worker_processes 1;
5
6events {
7 worker_connections 400000;
8 use epoll;
9}
10
11http {
12 include mime.types;
13 default_type application/octet-stream;
14
15 tcp_nopush on;
16 #tcp_nodelay on;
17 keepalive_timeout 20;
18 #send_timeout 10;
19 #client_body_timeout 10;
20 #client_header_timeout 10;
21 sendfile on;
22 client_header_buffer_size 1k;
23 large_client_header_buffers 1 2k;
24 client_max_body_size 5k;
25 client_body_buffer_size 5k;
26 ignore_invalid_headers on;
27 log_format main '$remote_addr - $remote_user [$time_local] $request '
28 '"$status" [$request_time $upstream_response_time] $body_bytes_sent "$http_referer" '
29 '"$http_user_agent" "$http_x_forwarded_for"';
30 access_log logs/access.log main;
31 error_log logs/error.log info;
32 push_stream_shared_memory_size 5000m;
33 push_stream_max_channel_id_length 200;
34 # max messages to store in memory
35 push_stream_max_messages_stored_per_channel 20;
36 # message ttl
37 push_stream_message_ttl 5s;
38 # ping frequency
39 push_stream_ping_message_interval 40s;
40 #connection ttl to enable recycle
41 #push_stream_subscriber_connection_ttl 9m;
42 # connection ttl for long polling
43 #push_stream_longpolling_connection_ttl 30m;
44 # broadcast
45 #push_stream_broadcast_channel_prefix "broad_";
46 push_stream_wildcard_channel_prefix "broad_";
47 #push_stream_message_template "{\"id\":~id~,\"channel\":\"~channel~\",\"text\":\"~text~\",\"eventid\":\"~event-id~\"}";
48 push_stream_message_template "{\"id\":~id~,\"channel\":\"~channel~\",\"text\":\"~text~\"}";
49
50 # subscriber may create channels on demand or only authorized
51 # (publisher) may do it?
52 push_stream_authorized_channels_only off;
53 #push_stream_broadcast_channel_max_qtd 3;
54 push_stream_wildcard_channel_max_qtd 3;
55
56 server {
57# listen 8080 default_server;
58 listen 8080 default_server so_keepalive=on so_keepalive=50:5:3 backlog=8192;
59 server_name localhost;
60
61 location ~ /lp/(.*) {
62 # activate long-polling mode for this location
63 push_stream_subscriber long-polling;
64
65 # positional channel path
66 #set $push_stream_channels_path $1;
67 push_stream_channels_path $1;
68 set $push_stream_token $arg_token;
69
70 push_stream_store_messages on;
71 push_stream_logserver_report 1;
72 push_stream_logserver_ip "172.18.0.22";
73 push_stream_logserver_port 6019;
74 push_stream_sac_check 1;
75 push_stream_sac_ip "172.18.0.22";
76 push_stream_sac_port 7890;
77 push_stream_rpc_timeout_ms 1000;
78 }
79
80 location ~ /ws/(.*) {
81 # activate websocket mode for this location
82 #push_stream_websocket;
83 push_stream_subscriber websocket;
84 # positional channel path
85 #set $push_stream_channels_path $1;
86 push_stream_channels_path $1;
87 set $push_stream_token $arg_token;
88
89 # store messages in memory
90 push_stream_store_messages on;
91
92 push_stream_websocket_allow_publish on;
93 push_stream_logserver_report 1;
94 push_stream_logserver_ip "172.18.0.22";
95 push_stream_logserver_port 6019;
96 push_stream_sac_check 1;
97 push_stream_sac_ip "172.18.0.22";
98 push_stream_sac_port 7890;
99 push_stream_rpc_timeout_ms 1000;
100 push_stream_redis_report 1;
101 push_stream_redis_ip "172.18.0.23";
102 push_stream_redis_port 6379;
103 }
104
105 }
106
107 server {
108 listen 8094 ssl;
109 ssl_certificate /home/ngxpush/ssl/server.crt;
110 ssl_certificate_key /home/ngxpush/ssl/server.key;
111 server_name localhost;
112
113 location /channels-stats {
114 # activate channels statistics mode for this location
115 push_stream_channels_statistics;
116
117 # query string based channel id
118 #set $push_stream_channel_id $arg_id;
119 push_stream_channels_path $arg_id;
120 }
121
122 location /pub {
123 # activate publisher mode for this location, with admin support
124 push_stream_publisher admin;
125
126 # query string based channel id
127 #set $push_stream_channel_id $arg_id;
128 push_stream_channels_path $arg_id;
129 set $push_stream_msg_id $arg_msgid;
130
131 # store messages in memory
132 push_stream_store_messages on;
133
134 #push_stream_keepalive on;
135
136 # Message size limit
137 # client_max_body_size MUST be equal to client_body_buffer_size or
138 # you will be sorry.
139 client_max_body_size 32k;
140 client_body_buffer_size 32k;
141 }
142
143 location /nginx_status
144 {
145 stub_status on;
146 access_log off;
147 allow 172.18.0.0/24;
148 deny all;
149 }
150 }
151}