I've got nginx running handling all SSL stuff and already proxying /
to a Redmine instance and /ci
to a Jenkins instance.
Now I want to serve an IPython instance on /ipython
through that very same nginx.
In nginx.conf
I've added:
http {
...
upstream ipython_server {
server 127.0.0.1:5001;
}
server {
listen 443 ssl default_server;
... # all SSL related stuff and the other proxy configs (Redmine+Jenkins)
location /ipython {
proxy_pass http://ipython_server;
}
}
}
In my .ipython/profile_nbserver/ipython_notebook_config.py
I've got:
c.NotebookApp.base_project_url = '/ipython/'
c.NotebookApp.base_kernel_url = '/ipython/'
c.NotebookApp.port = 5001
c.NotebookApp.trust_xheaders = True
c.NotebookApp.webapp_settings = {'static_url_prefix': '/ipython/static/'}
Pointing my browser to https://myserver/ipython
gives me the usual index page of all notebooks in the directory I launched IPython.
However, when I try to open one of the existing notebooks or create a new one, I'm getting the error:
WebSocket connection failed: A WebSocket connection to could not be established. You will NOT be able to run code. Check your network connection or notebook server configuration.
I've tried the same setup with the current stable (1.2.1, via pypi) and development (Git checkout of master) version of IPython.
I also tried adjusting the nginx config according to nginx reverse proxy websockets with no avail.
Due to an enforced policy I'm not able to allow connections to the server on other ports than 443.
Does anybody have IPython running behind an nginx?
Configure Nginx to pass web requests to that socket by making some small additions to its configuration file. Create a configuration file named py-app within the /etc/nginx/sites-available directory. Open up a server block and tell Nginx to listen on the default port 80. Add a location block that matches every request.
Nginx is a web server that can also be used as a reverse proxy, load balancer, mail proxy, and HTTP cache. It’s easy to install that only using this clean line. Check the version of it just to make sure… To make sure again for you that have a trust issue, you can check on your web by submitting your VM’s IP.
Generate a sha1 sum of the password you want to use, in an ipython shell: Update the config generated in the --generate-config command c.NotebookApp.allow_origin = '*' c.NotebookApp.base_url = '/groot' c.NotebookApp.password = 'sha1: [put generated password here...]' c.NotebookApp.port = 8888
I had the same problem. I updated nginx up to the current version (1.6.0). It seems to be working now.
Server config:
location /ipython {
proxy_pass http://ipython_server;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Origin "";
}
See: http://nginx.org/en/docs/http/websocket.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With