安装Jupyter notebook
python 3.8.8版本
#直接pip安装
pip install jupyter
配置jupyter
jupyter notebook --generate-config
#jupyter_notebook_config.py
grep -Ev "^$|[#;]" /home/linux/.jupyter/jupyter_notebook_config.py
c.NotebookApp.allow_remote_access = True
c.NotebookApp.open_browser = False
c.NotebookApp.password = 'sha1:f9de768177ff:96f051077f40e5d9e72431429bf2b46abxxxxxe3'
c.NotebookApp.port = 8889
关于password 是用命令行python3 -c "import IPython;print(IPython.lib.passwd())"进行成生的,输入密码把生成的内容粘贴到上面jupyter_notebook_config.py配置.
运行 jupyter
nohup jupyter notebook --allow-root &
nginx配置方向代理
upstream notebook {
server localhost:8889;
}
server{
listen 80;
server_name notebook.abc.com;
location / {
proxy_pass http://notebook;
proxy_set_header Host $host;
}
location ~ /api/kernels/ {
proxy_pass http://notebook;
proxy_set_header Host $host;
# websocket support
proxy_http_version 1.1;
proxy_set_header Upgrade "websocket";
proxy_set_header Connection "Upgrade";
proxy_read_timeout 86400;
}
location ~ /terminals/ {
proxy_pass http://notebook;
proxy_set_header Host $host;
# websocket support
proxy_http_version 1.1;
proxy_set_header Upgrade "websocket";
proxy_set_header Connection "Upgrade";
proxy_read_timeout 86400;
}
}
就简单记录一下...方便以后再次使用。。
网友评论