Nginx manager jupyter notebook v1.0.0 http websocket

v1.0.0

Environment introduction

1、 The virtual machine on this machine. There is jupyter in the virtual machine

2、 Jupyter notebook web server is an online editor

3、 A proxy server on this machine, such as nginx

Configuration steps

1、 Virtual machine

Start the virtual machine

2、 Jupyter

Set the root directory of the file
sudo GEDIT (VIM) ~ /. Jupyter/jupyter_ notebook_ config.py

c.NotebookApp.notebook_dir = '/path/to/jupyter'

sudo gedit(vim)~/.jupyter/jupyter notebook config.py

c.NotebookApp.allow_origin = '*' # allow cors

3、 Nginx

Start nginx configuration nginx.conf excerpt

# Actual tcp/websocket server address
    upstream jupyter_url {
        server virtual machine ip:8888;
    }

    server {
        listen       8000;
        server_name  localhost;

        charset utf-8;

      location/{
          proxy_pass http://jupyter_url;
          proxy_http_version 1.1;
          proxy_set_header Upgrade $http_upgrade; 
          proxy_set_header Connection "upgrade";
      }
	}

Test effect

Visit: nginxip: 8000

Read More: