Proxy的IP地址决定JupyterHub如何被用户访问,默认JupyterHub可以被所有网络接口的8000端口访问。

在IP配置时推荐使用0.0.0.0,而不是*

通过命令行选项配置IP及端口

jupyterhub --ip=192.168.1.2 --port=443

修改jupyterhub_config.py

c.JupyterHub.ip = '192.168.1.2'
c.JupyterHub.port = 443

REST API

默认,REST API会在localhost的8081端口监听。

配置api_url

c.ConfigurableHTTPProxy.api_url = 'http://10.0.1.4:5432'

也可以配置proxy_api_ipproxy_api_port,但是在0.8版本已经废弃

c.JupyterHub.proxy_api_ip = '10.0.1.4'
c.JupyterHub.proxy_api_port = 5432

远程配置

默认Hub service只会在localhost监听8081端口,同时供proxy和所有的Spawner访问。

如果Proxy或Spawner是远端的或通过容器隔离的,Hub必须在可访问的IP上监听

c.JupyterHub.hub_ip = '10.0.1.4'
c.JupyterHub.hub_port = 54321

在0.8版本中,增加c.JupyterHub.hub_connect_ip

c.JupyterHub.hub_ip = '0.0.0.0'  # listen on all interfaces
c.JupyterHub.hub_connect_ip = '10.0.1.4'  # ip as seen on the docker network. Can also be a hostname.

调整Hub URL

hub通常会以主机名运行,但是如果使用反向代理,URL变为https://proxy.example.org/jupyter/ ,这时,需要告诉JupyterHub服务的基本URL

c.JupyterHub.base_url = '/jupyter/'

【参考】

1。jupyterhub:网络配置:http://jupyterhub.readthedocs.io/en/latest/getting-started/networking-basics.html

results matching ""

    No results matching ""