Skip to content

Instantly share code, notes, and snippets.

@tashrifbillah
Created October 2, 2024 15:04
Show Gist options
  • Save tashrifbillah/89f34989ebaadb74552a6d149440a5a4 to your computer and use it in GitHub Desktop.
Save tashrifbillah/89f34989ebaadb74552a6d149440a5a4 to your computer and use it in GitHub Desktop.
Connect to Jupyter kernel remotely through Nginx proxy

In addition to the proxy_set_header stuff, I had to adjust my SELinux config:

setsebool -P httpd_read_user_content=on

systemctl restart nginx

I also needed the --ServerApp.allow_remote_access=True flag:

jupyter-notebook --NotebookApp.token=abcd1234 --ServerApp.allow_remote_access=True

And my nginx.conf is just like everyone else's:

        location / {
            proxy_pass http://127.0.0.1:8888;
            proxy_set_header Connection "";
            proxy_http_version 1.1;

            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-Proto $scheme;

            proxy_read_timeout 300s;
            proxy_connect_timeout 300s;
            proxy_send_timeout 300s;

        }

Now I can connect to my kernel remotely through Nginx proxy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment