-
-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathnginx.conf
99 lines (82 loc) · 2.46 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
pid /tmp/nginx.pid;
error_log /dev/null;
events {
worker_connections 1024;
}
http {
index index.html;
access_log off;
map $http_upgrade $goaccess {
websocket "socket";
default "web";
}
map $http_upgrade $goaccess_redirect {
websocket "socket_redirect";
default "web_redirect";
}
map $http_upgrade $goaccess_error {
websocket "socket_error";
default "web_error";
}
server {
listen 7880 default_server;
server_name _;
root /var/www/html;
index index.html;
access_log off;
location / {
#goan_authbasic
try_files /nonexistent @$goaccess;
}
location /redirection {
#goan_authbasic
try_files /nonexistent @$goaccess_redirect;
}
location /error {
#goan_authbasic
try_files /nonexistent @$goaccess_error;
}
location @web {
sub_filter 'WebSocket(str)' 'WebSocket(window.location.href.split("#")[0].replace(window.location.protocol, window.location.protocol == "https:" ? "wss://" : "ws://"))';
sub_filter_once on;
try_files $uri $uri/ =404;
}
location @web_redirect {
sub_filter 'WebSocket(str)' 'WebSocket(window.location.href.split("#")[0].replace(window.location.protocol, window.location.protocol == "https:" ? "wss://" : "ws://"))';
sub_filter_once on;
try_files $uri $uri/ =404;
}
location @web_error {
sub_filter 'WebSocket(str)' 'WebSocket(window.location.href.split("#")[0].replace(window.location.protocol, window.location.protocol == "https:" ? "wss://" : "ws://"))';
sub_filter_once on;
try_files $uri $uri/ =404;
}
location @socket {
proxy_pass http://localhost:7890;
proxy_connect_timeout 1d;
proxy_send_timeout 1d;
proxy_read_timeout 1d;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
location @socket_redirect {
proxy_pass http://localhost:7891;
proxy_connect_timeout 1d;
proxy_send_timeout 1d;
proxy_read_timeout 1d;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
location @socket_error {
proxy_pass http://localhost:7892;
proxy_connect_timeout 1d;
proxy_send_timeout 1d;
proxy_read_timeout 1d;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
}
}