第一步:生成证书
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem
第二步:生成秘钥和配置文件:
进入IPython
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password:xxxx # 这个是自己输入的密码,后面要用这个登录
Verify password:xxxx
Out[2]: 'sha1:xxxxx:xxxxxxxxxxxx'
jupyter notebook --generate-config
第三步:修改配置文件:
c = get_config()
# Kernel config
c.IPKernelApp.pylab = 'inline' # if you want plotting support always
# Notebook config
c.NotebookApp.certfile = u'mycert.pem地址'
c.NotebookApp.ip = '服务器IP地址'
c.NotebookApp.open_browser = False
c.NotebookApp.password = u'sha1:a181ded61c07:b19f42bb966f18596745884e30c8d46db8a6b28a'
# It's a good idea to put it on a known, fixed port
#sha1:a65635faf792:d831362331c6380103d5430ac260f5cc369c5d92
c.NotebookApp.port = 8022#10000..端口尽量多试几个
第四步:本地登录:
如果显示连接不安全,直接在当前页面输入thisisunsafe就可以了