pip install jupyter
jupyter notebook --generate-config
c.NotebookApp.allow_remote_access = True
c.NotebookApp.base_url = '/jupyter'
c.NotebookApp.enable_mathjax = True
#如果需要其他外网直接访问,下面ip设置为*
c.NotebookApp.ip = '127.0.0.1'
c.NotebookApp.notebook_dir = '/your/ipython/dir'
c.NotebookApp.open_browser = False
c.NotebookApp.password = 'sha1:c12803f3ed1c:cd79647ab4a16e3bd7c8b6c576cbdf13ab803785'
c.NotebookApp.port = 8889
修改nginx.conf,添加如下内容:
location /jupyter/ {
proxy_pass http://127.0.0.1:8889/jupyter/;
proxy_set_header host "127.0.0.1:8889";
proxy_set_header origin "http://127.0.0.1:8889/jupyter/";
proxy_set_header X-Real-IP "127.0.0.1";
# WebSocket proxying
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}