目录

Ubuntu 20.04 安装 Jupyter

更新于 2021-01-30

Jupyter

注意需要以管理员方式运行

sudo pip3 install --upgrade pip
sudo pip3 install jupyter

运行

jupyter notebook  --allow-root
nohup jupyter notebook  --allow-root &
tail -fn 50 nohup.out

反向代理

export JUYPTER_DOMAIN=note.whackeralpha.com
cat > /etc/nginx/conf.d/juypter.conf <<EOF
server{
        server_name $JUYPTER_DOMAIN;
		client_max_body_size    50m;
        location / {
               proxy_pass http://127.0.0.1:8888;
				proxy_set_header Host  \$host;
        }
}
EOF
nginx -t && certbot --nginx

源码

server{
        server_name note.whackeralpha.com;
		client_max_body_size    50m;
        location / {
               proxy_pass http://127.0.0.1:8888;
				proxy_set_header Host  $host;
        		proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
        }
}

配置

jupyter notebook --generate-config
c.NotebookApp.allow_remote_access = True

c.NotebookApp.allow_origin = '*'

4c671607fca72d0b33cfe030cced4d5212a9d8d07ba14bcc