ljouhet@jupyter:~$ cat /etc/nginx/sites-enabled/default
server {
listen 80;
server_name code.ljouhet.net;
return 302 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name code.ljouhet.net;
ssl_certificate /etc/letsencrypt/live/code.ljouhet.net/cert.pem;
ssl_certificate_key /etc/letsencrypt/live/code.ljouhet.net/privkey.pem;
location ~ /.well-known { # Let's Encrypt
allow all;
}
location /ssh/ { # Wetty: Terminal over https
return 302 /wetty/;
}
location /wetty/ {
include /etc/nginx/snippets/myproxy.conf;
proxy_pass https://127.0.0.1:3000/wetty/;
}
location / { # JupyterHub
include /etc/nginx/snippets/myproxy.conf;
proxy_pass https://127.0.0.1:8000/;
}
}
ljouhet@jupyter:~$ cat /etc/nginx/snippets/myproxy.conf
proxy_http_version 1.1;
proxy_read_timeout 43200000;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;