Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/security/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在nginx后面的子路径中配置IPython?_Nginx_Proxy_Websocket_Ipython - Fatal编程技术网

如何在nginx后面的子路径中配置IPython?

如何在nginx后面的子路径中配置IPython?,nginx,proxy,websocket,ipython,Nginx,Proxy,Websocket,Ipython,我已经让nginx运行来处理所有SSL内容,并且已经代理了一个Redmine实例和一个Jenkins实例 现在我想通过同一个nginx在/IPython上提供一个IPython实例 在nginx.conf中,我添加了: http { ... upstream ipython_server { server 127.0.0.1:5001; } server { listen 443 ssl default_server;

我已经让nginx运行来处理所有SSL内容,并且已经代理了一个Redmine实例和一个Jenkins实例

现在我想通过同一个nginx在
/IPython
上提供一个IPython实例

nginx.conf
中,我添加了:

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;
        }
    }
}
在我的
.ipython/profile\u nbserver/ipython\u notebook\u config.py
中,我得到了:

c.NotebookApp.base\u project\u url='/ipython/'
c、 NotebookApp.base_kernel_url='/ipython/'
c、 NotebookApp.port=5001
c、 NotebookApp.trust\u xheaders=True
c、 NotebookApp.webapp_设置={'static_url_前缀':'/ipython/static/'}

将我的浏览器指向
https://myserver/ipython
提供了我启动IPython目录中所有笔记本电脑的常用索引页。
但是,当我尝试打开一个现有笔记本或创建一个新笔记本时,我会遇到以下错误:

WebSocket连接失败:无法建立到的WebSocket连接。您将无法运行代码。检查网络连接或笔记本服务器配置

我在IPython的当前稳定版(1.2.1,通过pypi)和开发版(Git主控签出)上尝试了相同的设置。
我还尝试根据调整nginx配置,但没有成功。
由于强制的策略,我无法允许在443以外的其他端口上连接到服务器


有人让IPython在nginx后面运行吗?

我也有同样的问题。我将nginx更新到当前版本(1.6.0)。它现在似乎起作用了

服务器配置:

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 "";
}

请参阅:

您使用的是什么版本的NGINX?我的Ubuntu服务器上出现了完全相同的问题。我运行的是Ubuntu 12.04,NGINX的版本是1.1.19。环顾四周,似乎websockets代理转发直到NGINX中的1.3.0版本才得到解决。因此,我遵循以下指南:升级NGINX(就我而言,我现在运行的是1.5.13)。之后一切都很顺利。我不得不添加
proxy\u set\u header Origin'以使此工作正常。Tornado服务器不接受其他连接,因为原点检查未通过。^^^^此注释至关重要!既然我在进行跨域调用,那么我该如何处理需要传递
Origin
头的情况呢?我不知道为什么,但这对我也很有效。我的配置中的所有内容都可以从文档中获得,但在访问笔记本时,我仍然得到了404,直到我对我的nginx配置所做的更改今天仍然有效