-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathnginx.conf
135 lines (105 loc) · 4.22 KB
/
nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
pid logs/nginx.pid;
error_log stderr debug;
daemon off;
worker_rlimit_core 2500M;
working_directory /tmp;
worker_processes auto;
worker_rlimit_nofile 600000;
events {
worker_connections 200000;
use epoll;
multi_accept on;
}
http {
access_log logs/nginx-http_access.log;
push_stream_shared_memory_size 300m;
push_stream_max_channel_id_length 200;
# ping frequency
push_stream_ping_message_interval 30s;
# The TTL is disabled for the moment because ping messages are not being sent
# https://github.com/wandenberg/nginx-push-stream-module/issues/190
# push_stream_subscriber_connection_ttl 15m;
# connection ttl for long polling
push_stream_longpolling_connection_ttl 30s;
push_stream_timeout_with_body off;
push_stream_max_messages_stored_per_channel 100;
push_stream_store_messages on;
# subscriber may create channels on demand or only authorized (publisher) may do it?
push_stream_authorized_channels_only off;
push_stream_allowed_origins "*";
push_stream_message_template "~time~.~channel~.~text~";
server {
listen 42631;
# if over ssl:
# listen 42638 ssl;
# ssl_certificate /var/certs/cert.crt;
# ssl_certificate_key /var/certs/key.key;
# else
listen 42632;
listen 80;
server_name localhost;
location /socket.io {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:42633;
}
location /channels-stats {
# activate channels statistics mode for this location
push_stream_channels_statistics;
# query string based channel id
push_stream_channels_path $arg_id;
allow 127.0.0.1;
deny all;
}
location /pub {
# activate publisher mode for this location, with admin support
push_stream_publisher admin;
# query string based channel id
push_stream_channels_path $arg_id;
# 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;
allow 127.0.0.1;
deny all;
}
location ~ /sub/(.*) {
# activate subscriber mode for this location
push_stream_subscriber;
# positional channel path
push_stream_channels_path $1;
push_stream_last_received_message_time "$arg_time";
}
location ~ /ev/(.*) {
# activate event source mode for this location
push_stream_subscriber eventsource;
# positional channel path
push_stream_channels_path $1;
push_stream_last_received_message_time "$arg_time";
}
location ~ /lp/(.*) {
# activate long-polling mode for this location
push_stream_subscriber long-polling;
# positional channel path
push_stream_channels_path $1;
push_stream_last_received_message_time "$arg_time";
}
location ~ /jsonp/(.*) {
# activate long-polling mode for this location
push_stream_subscriber long-polling;
push_stream_channels_path $1;
push_stream_last_received_message_time "$arg_time";
}
location ~ /ws/(.*) {
# activate websocket mode for this location
push_stream_subscriber websocket;
# positional channel path
push_stream_channels_path $1;
push_stream_last_received_message_time "$arg_time";
}
}
}