Jupyter Notebook and Nginx Setup
2018-02-03 18:05
561 查看
The Jupyter Notebook is a web application that allows you to create and share documents that contain live code, equations, visualizations and explanatory text. Uses include: data cleaning and transformation, numerical simulation, statistical modeling, machine
learning and much more.
Jupyter project had a long history of development, It started with the Ipython project which provides a rich set of tools for computing and visualization with Python at it’s core. In the recent years the Ipython project broke into small components and the
Kernel is the core of Jupyter.
Jupyter supports multiple programming languages.
For more information click here
Jupyter Installation
I would suggest installing from continuum anaconda project. It provides a seemless package management and virtual env setup tool. And also provides a rich set of libraries bundled with the setup. You can find the instruction
here
Setting up the Notebook Server
You can start the notebook server as:
1 2 3 | jupyter notebook #for all the args jupyter notebook --help-all |
Demonizing the Notebook Server For Ubuntu
1 2 3 | touch /etc/init/yourupstartjobname.conf #content for your Upstart file description "Service for jupyter notebook" author "You" start on filesystem or runlevel [2345] stop on shutdown respawn script echo $$ > /var/run/jupyter.pid exec /pathto/anaconda3/bin/jupyter notebook --no-browser --NotebookApp.allow_origin='*' --notebook-dir='/pathtoworkspace' end script pre-stop script rm /var/run/jupyter.pid end script |
As the Notebook server runs On Tornado which uses the websockets for some part of the Client Interaction. Standard nginx proxy pass uses the Http protocal. So we need to add some configuration to work.
For Interacting with the Terminal and And Kernel it uses the WSS(websocket protocal). You can find more about this
here
Heres My Nginx configuation.
1 2 3 | upstream notebook { server localhost:8888; } server{ listen 80; server_name xyz.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; } } |
相关文章推荐
- 180203 Jupyter Notebook and Markdown 插入图片位置并调整比例
- 28 Jupyter Notebook tips, tricks and shortcuts
- 笔记-kagger都在用的python编辑器-Jupyter Notebook
- Windows下配置jupyter notebook的python3与R运行环境
- windows安装python,jupyter notebook
- 修改jupyter notebook默认工作目录
- 解决Jupyter notebook[import tensorflow as tf]报错
- Docker 安装jupyter notebook
- Windows下的Jupyter Notebook 的介绍(写给新手)(图文详解)
- Jupyter IPython dead kernel and do not restart
- elasticsearch5.3.0安装以及与基于jupyter notebook 的spark交互
- Jupyter Notebook 快捷键
- Jupyter Notebook 学习篇
- Jupyter Notebook各种使用方法记录
- Jupyter Notebook 使用IE打开显示不出界面的问题
- Jupyter notebook安装与使用
- Varnish and nginx setup
- 在阿里云ECS云端运行Jupyter Notebook
- 修改Jupyter Notebook默认工作路径
- 在 Jupyter Notebook 中更换主题与折叠代码