jupyter 配置
配置文件在 /{user.dir}/.jupyter/jupyter_notebook_config.py
c.notebookapp.ip = '*' c.notebookapp.open_browser = false c.notebookapp.password = u'sha1:2b64ebc42383:6f0cd4eb5ea9ede24b76e3baebe91aa1d051f62c' c.notebookapp.port = 8888 c.notebookapp.iopub_data_rate_limit=1.0e10 #配置 jupyter 的路径 c.notebookapp.base_url = '/nb/'
- 如果没有此配置文件,请使用 jupyter notebook --generate-config产生
- c.notebookapp.password请使用 jupyter notebook password生成
nginx 配置
jupyter 使用了 websocket 协议,所以需要配置支持 websocket。
在nginx的配置文件conf/nginx.conf文件中的http.server中配置代理如下:
location /nb {
proxy_pass http://172.25.101.28:10088/nb;
proxy_set_header host $host:$server_port;
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;
# websocket support
proxy_http_version 1.1;
proxy_set_header upgrade $http_upgrade;
proxy_set_header connection "upgrade";
proxy_read_timeout 120s;
proxy_next_upstream error;
proxy_redirect off;
proxy_buffering off;
}
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持代码网。
发表评论