- First, you need install jupyter notebook using
pip install jupyter
- Second, you need run notebook on the work dir using
jupyter notebook --no-browser --port=9998 --NotebookApp.base_url=/notebook
.- this make you notebook run on port 9998 with base url '/notebook', you need this base url for nginx dispatching
- Third, config you nginx config, and test is with
sudo nginx -t -c /etc/nginx/nginx.conf
, if ok reload nginx withsudo nginx -s reload -c /etc/nginx/nginx.conf
location /notebook/ {
proxy_pass http://localhost:9998;
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;
}
- then you can tap ip of your machine like
$ip/notebook
, notebook for nginx to dispatch to jupyter notebook
ref this will do as well, http://www.albertauyeung.com/post/setup-jupyter-nginx-supervisor/