简体   繁体   中英

Configuration for Jupyter Notebook on a home Ubuntu server: kernel is not connecting

I set up an Ubuntu server to host a Jupyter Notebook that I can access from the web. Everything seems to work but whenever I open the notebook, the Python Kernel is stuck and it does not connect:

在此处输入图像描述

In the terminal, with the current configuration it does not report warnings or errors:

在此处输入图像描述

but I have tried many similar configurations and sometimes, when the kernel tried to connect, it was showing warnings like:

  • [W 01:51:26.202 NotebookApp] 400 GET /api/kernels/aa45474d-7fb8-4685-98dc-5ebeba378f41/channels?
  • [W 16:06:07.386 NotebookApp] 403 GET /api/kernels/f589fe39-b21c-4eb1-9543-dcf2b9c5881d/channels?

I have found various similar issues online and they usually point to either the Jupyter configuration or the Apache/nginx configuration, however I have tried many of the proposed configurations and none of them solved my problem. I cannot exclude the problem is somewhere else.

jupyter_notebook_config.py: 在此处输入图像描述 Notice that I have commented out the references to the certificate, if I don't, then the notebook browser will give a "proxy error" and it won't load. However, the certificate is loaded in the apache configuration and seems to work fine there. Is it necessary to have it loaded here as well?

apache configuration: 在此处输入图像描述 Commented out are some of the many lines I tried to add following suggestions from other pages. Any help will be really welcome, I have been stuck on this for one week now.

After a full day of attempts I found a solution.

  1. In the notebook configuration I uncommented the certificate lines.

  2. In the apache configuration I added:

    SSLProxyEngine On

  3. I have changed the reverse proxy lines using https:

    ProxyPass https://localhost:5000/notebook

    ProxyPassReverse https://localhost:5000/notebook

  4. I removed the authentication lines:

    AuthName "Please login"

    AuthType basic

    AuthBasicProvider file

    AuthUserFile "/home/pomi/auth_file_name"

    Require valid-user

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM