Skip to content

Instantly share code, notes, and snippets.

@pavan538
Created August 7, 2018 10:36
Show Gist options
  • Save pavan538/378669288b9bd9af2fd82e5c107394fc to your computer and use it in GitHub Desktop.
Save pavan538/378669288b9bd9af2fd82e5c107394fc to your computer and use it in GitHub Desktop.
jupyter notebook browser with nginx and supervisor

create a jupyter.conf supervisor setting file

[program:jupyter]
command = /home/ubuntu/virtual_envs/kaggle/bin/jupyter notebook --no-browser --config=/home/ubuntu/.jupyter/jupyter_notebook_config.py
environment=PATH="/home/ubuntu/virtual_envs/kaggle/bin:%(ENV_PATH)s"
directory = /home/ubuntu/ml
user = ubuntu
autostart = true
autorestart = true
redirect_stderr = true

In the nginx servers section please add the following line

location /notebook {
    proxy_pass http://localhost:8888;
    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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment