-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
93 lines (78 loc) · 2.93 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
user www-data;
pid /run/nginx.pid;
worker_processes auto;
worker_rlimit_nofile 65535;
# Load modules
include /etc/nginx/modules-enabled/*.conf;
events {
multi_accept on;
worker_connections 65535;
}
http {
sendfile on;
tcp_nopush on;
client_max_body_size 500M;
# MIME
include mime.types;
default_type application/octet-stream;
# Logging
access_log off;
error_log /var/log/nginx/error.log warn;
log_format main '$time_iso8601 - $remote_addr↔ $upstream_addr [$proxy_add_x_forwarded_for $http_host] - $status "$request" - $body_bytes_sent - $request_time ';
proxy_buffering off;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
# Needed for websockets
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# Load configs
include /etc/nginx/conf.d/*.conf;
upstream jatos-backend {
server jatos:9000;
}
# Redirect http to https
server {
listen 80;
server_name www.example.com;
rewrite ^ https://www.example.com$request_uri? permanent;
}
server {
listen 443 ssl http2;
server_name www.example.com;
keepalive_timeout 70;
# Encryption
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
ssl_protocols TLSv1.2 TLSv1.3;
# WebSocket location (JATOS' group and batch channel and the test page)
location ~ "/(jatos/testWebSocket|publix/[a-z0-9-]+/(group/join|batch/open))" {
proxy_pass http://jatos-backend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_connect_timeout 7d; # Keep open for 7 days even without any transmission
proxy_send_timeout 7d;
proxy_read_timeout 7d;
}
# Restrict access to JATOS' GUI to local network 192.168.1.*
# location /jatos {
# allow 192.168.1.0/24;
# deny all;
# proxy_pass http://jatos-backend;
# proxy_connect_timeout 300;
# proxy_send_timeout 300;
# proxy_read_timeout 300;
# send_timeout 300;
# }
# All other traffic
location / {
proxy_pass http://jatos-backend;
proxy_connect_timeout 300;
proxy_send_timeout 300;
proxy_read_timeout 300;
send_timeout 300;
}
}
}