apache代理后面的笔记本

时间:2015-02-17 21:46:47

标签: apache ipython-notebook mod-proxy

我试图在Apache2代理后面运行iPython Notebook,但我遇到了WebSockets问题。

我想通过 < domain> / python / 访问笔记本。

使用一些教程和apache wiki,我设法编写了这个VirtualHosts文件:

# Trying to proxy WS requests
ProxyPass /python/api/kernels ws://127.0.0.1:8888/python/api/kernels
ProxyPassReverse /python/api/kernels ws://127.0.0.1:8888/python/api/kernels

# Proxy HTTP requests
ProxyPass /python http://127.0.0.1:8888/python
ProxyPassReverse /python http://127.0.0.1:8888/python
ProxyRequests On

# Spoof headers only if the URL contains "/python/" (I have other stuff on this VHost)
<If "%{QUERY_STRING} =~ /python/">
   Header set Host "http://127.0.0.1:8888/python"
   Header set Origin "http://127.0.0.1:8888/python"

   RequestHeader set Host "http://127.0.0.1:8888/python"
   RequestHeader set Origin "http://127.0.0.1:8888/python"
</If>

这是我的笔记本资料配置:

c = get_config()

c.NotebookApp.ip = '127.0.0.1'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888

c.NotebookApp.base_url = '/python/'
c.NotebookApp.tornado_settings = {'static_url_prefix':'/python/static/'}
c.NotebookApp.allow_origin='http://127.0.0.1:8888/python'
c.NotebookApp.notebook_dir = '/home/franga2000/iPython/'

我在NB控制台中收到此错误(也适用于/stdin/iopub

WARNING:tornado.access:400 GET /python/api/kernels/f2d21678-4fef-4cb4-996f-dcee954b54ca/shell (127.0.0.1) 0.44ms referer=None

我在Ubuntu 14.04 上使用Apache 2.4.7 。 此外,笔记本电脑正在运行virtualenv(怀疑其相关)。

有没有人知道这样做的方法(没有切换到nginx)?

0 个答案:

没有答案