官方文檔
https://jupyterhub.readthedocs.io/en/latest/reference/technical-overview.html
找一臺(tái)linux服務(wù)器專門(mén)用于jupyterhub的搭建
用root賬號(hào)啟動(dòng)jupyterhub,jupyterhub的賬號(hào)系統(tǒng)直接與linux的賬號(hào)相關(guān)
初始配置
為了實(shí)現(xiàn)跨域跳轉(zhuǎn)登錄
jupyterhub_config.py配置文件內(nèi)容增加:
# 登錄后默認(rèn)看到的頁(yè)面
c.Spawner.default_url = '/tree/'
# 跳轉(zhuǎn)路由
c.JupyterHub.base_url = u'/jupyter/'
c.JupyterHub.bind_url = 'http://127.0.0.1:8000/jupyter/'
# 允許跨域,模擬登陸生成cookie的時(shí)候會(huì)用到
c.Spawner.args = ['--NotebookApp.allow_origin=*']
c.JupyterHub.tornado_settings = {
'headers': {
'Access-Control-Allow-Origin': '*',
},
}
nginx代理配置
location /jupyter/ {
# 跨域配置
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods 'GET, POST, PUT, DELETE, OPTIONS';
add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
# jupyter地址
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-Scheme $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# ws配置
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 120s;
proxy_next_upstream error;
}
jupyter中使用matplotlib
調(diào)中文字體:https://blog.csdn.net/qq_41770424/article/details/115708626