使用curl访问时,JupyterHub连接被拒绝

时间:2018-07-02 02:37:46

标签: jupyterhub

我已遵循JupyterHub的QuickStart在Linux机器上成功安装JupyterHub,并通过键入启动服务

jupyterhub

并且输出表明现在服务器正在侦听端口8000:

$ jupyterhub
[I 2018-07-02 02:32:25.756 JupyterHub app:1656] Using Authenticator: jupyterhub.auth.PAMAuthenticator-0.9.0
[I 2018-07-02 02:32:25.756 JupyterHub app:1656] Using Spawner: jupyterhub.spawner.LocalProcessSpawner-0.9.0
[I 2018-07-02 02:32:25.759 JupyterHub app:1014] Loading cookie_secret from /home/ec2-user/jupyterhub_cookie_secret
[I 2018-07-02 02:32:25.775 JupyterHub proxy:429] Generating new CONFIGPROXY_AUTH_TOKEN
[W 2018-07-02 02:32:25.776 JupyterHub app:1160] No admin users, admin interface will be unavailable.
[W 2018-07-02 02:32:25.776 JupyterHub app:1161] Add any administrative users to `c.Authenticator.admin_users` in config.
[I 2018-07-02 02:32:25.776 JupyterHub app:1188] Not using whitelist. Any authenticated user will be allowed.
[I 2018-07-02 02:32:25.810 JupyterHub app:1838] Hub API listening on http://127.0.0.1:8081/hub/
[W 2018-07-02 02:32:25.811 JupyterHub proxy:481] Running JupyterHub without SSL.  I hope there is SSL termination happening somewhere else...
[I 2018-07-02 02:32:25.811 JupyterHub proxy:483] Starting proxy @ http://:8000
02:32:26.221 - info: [ConfigProxy] Proxying http://*:8000 to (no default)
02:32:26.223 - info: [ConfigProxy] Proxy API at http://127.0.0.1:8001/api/routes
02:32:26.735 - info: [ConfigProxy] 200 GET /api/routes
[I 2018-07-02 02:32:26.735 JupyterHub proxy:299] Checking routes
[I 2018-07-02 02:32:26.736 JupyterHub proxy:368] Adding default route for Hub: / => http://127.0.0.1:8081
02:32:26.737 - info: [ConfigProxy] Adding route / -> http://127.0.0.1:8081
02:32:26.738 - info: [ConfigProxy] 201 POST /api/routes/
[I 2018-07-02 02:32:26.739 JupyterHub app:1895] JupyterHub is now running at http://:8000

但是当我尝试通过curl访问服务器时,它只是表明它不可用。

$ curl localhost:8000
curl: (7) Failed to connect to localhost port 8000: Connection refused

有人遇到过同样的问题吗?任何建议都将受到高度赞赏!

1 个答案:

答案 0 :(得分:0)

我对jupyterhub_config.py进行了一些修改之后,就可以访问它了。以下是我的配置:

c = get_config()
c.JupyterHub.bind_url = 'http://localhost:8000'
c.JupyterHub.hub_ip='localhost'

为了在初次尝试配置JupyterHub时生成jupyterhub_config.py,可以键入:

jupyterhub --generate-config -f /etc/jupyterhub/jupyterhub_config.py

并使用文件jupyterhub_config.py启动jupyterHub:

sudo jupyterhub -f /etc/jupyterhub/jupyterhub_config.py