[IPython-dev] Jupyterhub behind NGINX redirect

Clare Sloggett claresloggett at gmail.com
Sun Oct 12 01:35:34 EDT 2014


Hi all,

Am I right in thinking this list is also the right place for questions
about Jupyterhub?

I'm trying to set up Jupyterhub for multiple users, on the same server
where we are running several other services. Currently there are NGINX
redirects in place to these other services. I'd like to set up
http://<public-url>/ipython/
to redirect to a port on localhost and run Jupyterhub over that port. Is
this possible?

I've got this working in the past with single-user IPython Notebook. For
that, I set config options c.NotebookApp.base_project_url,
c.NotebookApp.base_kernel_url, and c.NotebookApp.webapp_settings to be
aware of the ipython/ URL prefix. We used an NGINX redirect to forward
requests and handle websockets properly, which looked like

location /ipython/ {
    proxy_pass http://127.0.0.1:9510;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    }

This worked for the old single-user notebook. But, I'm not clear on the
model Jupyterhub is using (and I'm not much of a sysadmin). I read through
the command-line options, thought from them that I don't need to strip the
/ipython/ from the incoming requests, and have tried using a similar
redirect to the above and setting --JupyterHubApp.base_url='ipython/' and
also setting --port 9510. This does seem to see the incoming requests but
results in amusing requests like

500 GET
/ipython/ipython/hub/ipython/ipython/hub/ipython/ipython/hub/ipython/ipython/hub/ipython/ipython/hub/ipython/ipython/hub/ipython/ipython/hub/ipython/ipython/hub/ipython/ipython/hub/ipython/ipython/hub/ipython/ipython/hub/ipython/ipython/hub/ipython/ipython/hub/ipython/ipython/hub/ipython/ipython/hub/......

... so clearly I haven't understood what's going on. Does anyone have any
pointers on how this should work? I haven't read any docs other than the
README and the command-line parameter information, so apologies if there's
something obvious that I didn't look at.

I'm also interested in running Jupyterhub as a daemon, so if that's
something that's been done before and there's anything I should know, that
would be great.

Any help much appreciated!

Clare
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20141012/4983f0ef/attachment.html>


More information about the IPython-dev mailing list