簡體   English   中英

無法在 AWS EC2 瀏覽器上運行 Jupyter 說“無法訪問站點”

[英]Cannot run Jupyter on AWS EC2 Browser says “Site can't be reached”

我已經在他們的免費套餐上設置了一個 AWS 賬戶,在安裝 Anaconda 和 Jupyter Notebooks 后,我無法通過瀏覽器連接到 Jupyter Notebook。 我得到以下屏幕:

在此處輸入圖像描述

我設置它的過程主要總結在下面的鏈接中:

https://medium.com/@josemarcialportilla/getting-spark-python-and-jupyter-notebook-running-on-amazon-ec2-dec599e1c297

由於無法正常工作,我對上述中型文章流程進行了一些更改。 主要是我的證書中有以下命令

# Configuration file for jupyter-notebook.

c = get_config()



# Notebook config this is where you saved your pem cert

c.NotebookApp.certfile = u'/home/ubuntu/certs/mycert.pem'

# listen on all IPs

c.NotebookApp.ip = '0.0.0.0'

# Allow all origins

c.NotebookApp.allow_origin = '*'

# Don't open browser by default

c.NotebookApp.open_browser = False

# Fix port to 8888

c.NotebookApp.port = 8888

在我在瀏覽器中輸入必要的鏈接之前,一切似乎都符合預期。 當我在控制台中輸入 Jupyter notebooks 時,我得到以下信息(X 是字母數字,我認為我不應該分享):

[I 07:28:56.291 NotebookApp] Writing notebook server cookie secret to /run/user/1000/jupyter/notebook_cookie_secret
[I 07:28:57.297 NotebookApp] JupyterLab extension loaded from /home/ubuntu/anaconda3/lib/python3.7/site-packages/jupyterlab
[I 07:28:57.297 NotebookApp] JupyterLab application directory is /home/ubuntu/anaconda3/share/jupyter/lab
[I 07:28:57.299 NotebookApp] Serving notebooks from local directory: /home/ubuntu
[I 07:28:57.299 NotebookApp] The Jupyter Notebook is running at:
[I 07:28:57.299 NotebookApp] https://(ip-XXX-XX-XX-XXX or XXX.X.X.X):8888/?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[I 07:28:57.299 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 07:28:57.303 NotebookApp]

To access the notebook, open this file in a browser:
file:///run/user/1000/jupyter/nbserver-29637-open.html
Or copy and paste one of these URLs:
https://(ip-XXX-XX-XX-XXX or XXX.X.X.X):8888/?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

在瀏覽器中以及輸入教程中的內容:

https://XXX-X-XX-X-XXX.us-east-2.compute.amazonaws.com:8888

我也嘗試過以下方法:

https://XXX-X-XX-X-XXX.us-east-2.compute.amazonaws.com

https://(ip-XXX-XX-XX-XXX or XXX.XXX):8888/?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

https://ip-XXX-XX-XX-XXX:8888/?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

https://ip-XXX.XXX:8888/?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

這些似乎都不起作用。

如果有人有任何建議,將不勝感激。

謝謝

編輯

在重新創建實例之后,這次將安全設置設置為所有流量,而不僅僅是 SSH(感謝 Lamanus),瀏覽器現在只是不斷地嘗試連接,而控制台給出了下面的 output:

Exception in callback BaseAsyncIOLoop._handle_events(5, 1)
handle: <Handle BaseAsyncIOLoop._handle_events(5, 1)>
Traceback (most recent call last):
  File "/home/ubuntu/anaconda3/lib/python3.7/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tornado/platform/asyncio.py", line 138, in _handle_events
    handler_func(fileobj, events)
  File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tornado/netutil.py", line 273, in accept_handler
    callback(connection, address)
  File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tornado/tcpserver.py", line 288, in _handle_connection
    do_handshake_on_connect=False,
  File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tornado/netutil.py", line 605, in ssl_wrap_socket
    context = ssl_options_to_context(ssl_options)
  File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tornado/netutil.py", line 574, in ssl_options_to_context
    ssl_options["certfile"], ssl_options.get("keyfile", None)
PermissionError: [Errno 13] Permission denied
Exception in callback BaseAsyncIOLoop._handle_events(5, 1)
handle: <Handle BaseAsyncIOLoop._handle_events(5, 1)>
Traceback (most recent call last):
  File "/home/ubuntu/anaconda3/lib/python3.7/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tornado/platform/asyncio.py", line 138, in _handle_events
    handler_func(fileobj, events)
  File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tornado/netutil.py", line 273, in accept_handler
    callback(connection, address)
  File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tornado/tcpserver.py", line 288, in _handle_connection
    do_handshake_on_connect=False,
  File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tornado/netutil.py", line 605, in ssl_wrap_socket
    context = ssl_options_to_context(ssl_options)
  File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tornado/netutil.py", line 574, in ssl_options_to_context
    ssl_options["certfile"], ssl_options.get("keyfile", None)
PermissionError: [Errno 13] Permission denied

我在 Lamanus 的幫助下解決了這個問題。

正如我在編輯中所說,我必須重新創建我的實例,確保將安全設置從 SSH 更改為所有流量。

然后下次我激活我的終端時,我必須將 go 到 certs 文件夾並使用以下命令修改一些證書:

光盤證書

sudo chmod 777 mycert.pem

之后我去了一個屏幕,它要求我要一個令牌。 我提供的是控制台在下面末尾提供給我的令牌

https://ip-XXX-XX-XX-XXX:8888/?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

所以我把xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx部分復制粘貼到token區。

謝謝

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM