为什么EC2不能服务我的jupyter笔记本?
问题描述:
我设置了我的EC2,并配置了我的jupyter笔记本配置文件,如下所示:https://chrisalbon.com/jupyter/run_project_jupyter_on_amazon_ec2.html。为什么EC2不能服务我的jupyter笔记本?
我现在运行:jupyter笔记本电脑,这里就是我得到:
[I 03:42:26.400 NotebookApp] Serving notebooks from local directory: /home/ec2-
user/courses/deeplearning1/nbs
[I 03:42:26.400 NotebookApp] 0 active kernels
[I 03:42:26.400 NotebookApp] The Jupyter Notebook is running at: https://[all ip addresses on your
system]:8888/
[I 03:42:26.400 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to
skip confirmation).
然而,现在我想要去我的网站(http://ec2-54-202-213-129.us-west-2.compute.amazonaws.com:8888/),这就是我看到我的终端上。
Exception in callback (<socket.socket fd=6, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('0.0.0.0', 8801)>, <function wrap.<locals>.null_wrapper at 0x7fc3e0210620>)
Traceback (most recent call last):
File "/home/ec2-user/anaconda3/lib/python3.6/site-packages/tornado/ioloop.py", line 887, in start
handler_func(fd_obj, events)
File "/home/ec2-user/anaconda3/lib/python3.6/site-packages/tornado/stack_context.py", line 275, in null_wrapper
return fn(*args, **kwargs)
File "/home/ec2-user/anaconda3/lib/python3.6/site-packages/tornado/netutil.py", line 272, in accept_handler
callback(connection, address)
File "/home/ec2-user/anaconda3/lib/python3.6/site-packages/tornado/tcpserver.py", line 244, in _handle_connection
do_handshake_on_connect=False)
File "/home/ec2-user/anaconda3/lib/python3.6/site-packages/tornado/netutil.py", line 513, in ssl_wrap_socket
context = ssl_options_to_context(ssl_options)
File "/home/ec2-user/anaconda3/lib/python3.6/site-packages/tornado/netutil.py", line 490, in ssl_options_to_context
context.load_cert_chain(ssl_options['certfile'], ssl_options.get('keyfile', None))
IsADirectoryError: [Errno 21] Is a directory
任何想法我做错了什么?
答
起初你是否尝试用https://
代替http://
?即https://ec2-54-202-213-129.us-west-2.compute.amazonaws.com:8888/
不管这个,我想你应该遵循从官方文档的建议:http://jupyter-notebook.readthedocs.io/en/latest/public_server.html#using-ssl-for-encrypted-communication
- 创建证书和密钥:
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mykey.key -out mycert.pem
- 然后开始你的笔记本电脑是这样的:
jupyter notebook --certfile=mycert.pem --keyfile mykey.key
谢谢 - 这正是我所错过的。非常感谢! – Adam