-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathnginx.conf
63 lines (61 loc) · 2.12 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
# This goes in /etc/nginx/nginx.conf
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# based on the Jupyter team's tmpnb nginx.conf:
# https://github.com/jupyter/tmpnb-deploy/blob/master/roles/proxy/templates/nginx.conf.j2
# and Carl Boettiger's nginx.conf:
# https://gist.github.com/cboettig/8643341bd3c93b62b5c2
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
user www-data;
worker_processes 2;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Enumerate all the servers here
upstream jupyter {
ip_hash;
server 127.0.0.1:8000;
server 10.0.0.2:8000;
server 10.0.0.3:8000;
server 10.0.0.5:8000;
server 10.0.0.6:8000;
server 10.0.0.7:8000;
server 10.0.0.8:8000;
}
server {
listen 80;
server_name jupyter.rocks www.jupyter.rocks;
# rewrite ^ https://$host$request_uri? permanent; # if you do https
#}
# server {
# listen 443;
client_max_body_size 50M;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location / {
proxy_pass http://jupyter;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
#proxy_pass_header Server;
#proxy_redirect off;
proxy_set_header X-Scheme $scheme;
}
location ~* /(api/kernels/[^/]+/(channels|iopub|shell|stdin)|terminals/websocket)/? {
proxy_pass http://jupyter;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# WebSocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 86400;
}
}
}