我已经安装并配置了jupyter notebook作为公共服务器运行(有密码)。当我运行jupyter notebook
时,它告诉我fullchain.pem
文件不存在。
(jupyter) rootadmin@ubuntu12:~/opensurfaces$ jupyter notebook
Traceback (most recent call last):
File "/home/rootadmin/opensurfaces/jupyter/bin/jupyter-notebook", line 8, in <module>
sys.exit(main())
File "/home/rootadmin/opensurfaces/jupyter/lib/python3.6/site-packages/jupyter_core/application.py", line 270, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/home/rootadmin/opensurfaces/jupyter/lib/python3.6/site-packages/traitlets/config/application.py", line 663, in launch_instance
app.initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File "/home/rootadmin/opensurfaces/jupyter/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/home/rootadmin/opensurfaces/jupyter/lib/python3.6/site-packages/notebook/notebookapp.py", line 1769, in initialize
self.init_webapp()
File "/home/rootadmin/opensurfaces/jupyter/lib/python3.6/site-packages/notebook/notebookapp.py", line 1485, in init_webapp
max_buffer_size=self.max_buffer_size)
File "/home/rootadmin/opensurfaces/jupyter/lib/python3.6/site-packages/tornado/util.py", line 286, in __new__
instance.initialize(*args, **init_kwargs)
File "/home/rootadmin/opensurfaces/jupyter/lib/python3.6/site-packages/tornado/httpserver.py", line 191, in initialize
read_chunk_size=chunk_size,
File "/home/rootadmin/opensurfaces/jupyter/lib/python3.6/site-packages/tornado/tcpserver.py", line 134, in __init__
'certfile "%s" does not exist' % self.ssl_options["certfile"]
ValueError: certfile "/etc/letsencrypt/live/my_website_url/fullchain.pem" does not exist
在juputer_notebook_config.py
文件中,我有以下内容
## The full path to an SSL/TLS certificate file.
c.NotebookApp.certfile = u'/etc/letsencrypt/live/my_website_url/fullchain.pem'
该文件存在(在该确切位置),具有以下权限
(jupyter) rootadmin@ubuntu12:/etc/letsencrypt/live/my_website_url$ ls -l
total 4
lrwxrwxrwx 1 root root 49 Mar 12 12:26 cert.pem -> ../../archive/my_website_url/cert9.pem
lrwxrwxrwx 1 root root 50 Mar 12 12:26 chain.pem -> ../../archive/my_website_url/chain9.pem
lrwxrwxrwx 1 root root 54 Mar 12 12:26 fullchain.pem -> ../../archive/my_website_url/fullchain9.pem
lrwxrwxrwx 1 root root 52 Mar 12 12:26 privkey.pem -> ../../archive/my_website_url/privkey9.pem
我不能用我的用户(例如nano fullchain.pem
)读取这个文件,但是我可以用sudo nano
读取它,我想我可以把文件复制到jupyter可以读取的位置,但是这看起来有点傻。
我怎样才能使jupyter笔记本工作?
- edit*:如果我确实只是简单地将证书文件复制到不同的位置,它看起来是有效的。那么我遇到了一个不同的,而且我认为是无关的问题。我提出了一个关于that problem的单独问题
1条答案
按热度按时间68bkxrlz1#
出现此错误是因为jupyter没有足够的权限读取证书文件。
要解决此问题,请使用
chmod 755
确保所有父文件夹(/etc/letsencrypt/live/my_website_url和../../archive/my_website_url/fullchain9.pem)和证书可读。例如,运行以下命令:
chmod 755 /etc
chmod 755 /etc/letsencrypt
chmod 755 /etc/letsencrypt/live
chmod 755 /etc/letsencrypt/live/my_website_url
chmod 777 /etc/letsencrypt/live/my_website_url/fullchain.pem
chmod 777 /etc/letsencrypt/live/my_website_url/privkey.pem
chmod 755 /etc/letsencrypt/archive
chmod 755 /etc/letsencrypt/archive/my_website_url
chmod 777 /etc/letsencrypt/archive/my_website_url/fullchain1.pem
chmod 777 /etc/letsencrypt/archive/my_website_url/privkey1.pem
你可以简单地使用
cat xxx.pem
而不用sudo来测试,如果你能得到内容,jupyter笔记本应该也能读到。