Setting up jupyter lab behind a reverse proxy (nginx): Difference between revisions
(Created page with "How to reverse proxy jupyter: On your /etc/nginx/sites-available/default where 9068 is the port you have configured... jupyter <code> server { ... location ^~...") |
No edit summary |
||
Line 3: | Line 3: | ||
where 9068 is the port you have configured... jupyter | where 9068 is the port you have configured... jupyter | ||
< | <pre> | ||
server { | server { | ||
... | ... | ||
Line 24: | Line 24: | ||
proxy_read_timeout 86400; | proxy_read_timeout 86400; | ||
} | } | ||
</ | </pre> | ||
Generate a jupyter password "hash", in python (3) ... | Generate a jupyter password "hash", in python (3) ... |
Revision as of 17:54, 27 January 2021
How to reverse proxy jupyter:
On your /etc/nginx/sites-available/default
where 9068 is the port you have configured... jupyter
server { ... location ^~ /__lab__/ { proxy_pass http://localhost:9068/; # include /etc/nginx/includes/lab.conf; # this line is only useful for the sandbox! rewrite /(.*) /sandbox/$1 break; error_page 502 /lab/502.html; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; proxy_http_version 1.1; proxy_redirect off; proxy_buffering off; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_read_timeout 86400; }
Generate a jupyter password "hash", in python (3) ...
python
from IPython.lib import passwd
print(passwd("yourspecialpassword"))
In a (new) jupyter config file:
nano ~/.jupyter/jupyter_notebook_config.py
c.NotebookApp.base_url = '/__lab__/' c.NotebookApp.port =9068 c.NotebookApp.trust_xheaders = True c.NotebookApp.port_retries = 0 c.NotebookApp.password = 'password_hash_from_python_above' c.NotebookApp.allow_remote_access = True