Skip to content

Instantly share code, notes, and snippets.

@shm007g
Created November 2, 2018 08:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shm007g/8d31ff4d5a86a98d345440f1a7909e16 to your computer and use it in GitHub Desktop.
Save shm007g/8d31ff4d5a86a98d345440f1a7909e16 to your computer and use it in GitHub Desktop.
  • 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 with sudo 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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment