簡體   English   中英

如何公開查看我在Amazon EC2上托管的網站?

[英]How to publicly view website that I am hosting on amazon-ec2?

我已經啟動了一個Amazon-ec2實例,並公開了ec2-12-34-567-89.us-west-2.compute.amazonaws.com的DNS。 我在那里設置了一個安全組,其中類型為HTTP,協議為TCP,端口范圍為80,源為0.0.0.0/。 我登錄到EC2實例並啟動我的應用程序:

$ python3 run.py
 * Running on http://0.0.0.0:0/

然后,使用瀏覽器嘗試打開: http : //ec2-12-34-567-89.us-west-2.compute.amazonaws.com並收到“無法連接”消息。

我在這里想念什么?

編輯

使用端口80,它最終會像這樣:

$ python3 run.py
 * Running on http://0.0.0.0:80/
Traceback (most recent call last):
  File "run.py", line 5, in <module>
    app.run(host="0.0.0.0", port=80)
  File "/opt/python/3.4.1/lib/python3.4/site-packages/flask/app.py", line 772, in run
    run_simple(host, port, self, **options)
  File "/opt/python/3.4.1/lib/python3.4/site-packages/werkzeug/serving.py", line 710, in run_simple
   inner()
  File "/opt/python/3.4.1/lib/python3.4/site-packages/werkzeug/serving.py", line 692, in inner
    passthrough_errors, ssl_context).serve_forever()
  File "/opt/python/3.4.1/lib/python3.4/site-packages/werkzeug/serving.py", line 486, in make_server
    passthrough_errors, ssl_context)
  File "/opt/python/3.4.1/lib/python3.4/site-packages/werkzeug/serving.py", line 410, in __init__
    HTTPServer.__init__(self, (host, int(port)), handler)
  File "/opt/python/3.4.1/lib/python3.4/socketserver.py", line 429, in __init__
    self.server_bind()
  File "/opt/python/3.4.1/lib/python3.4/http/server.py", line 133, in server_bind
    socketserver.TCPServer.server_bind(self)
  File "/opt/python/3.4.1/lib/python3.4/socketserver.py", line 440, in server_bind
    self.socket.bind(self.server_address)
PermissionError: [Errno 13] Permission denied

顯然我需要以超級用戶身份運行代碼。

$ **sudo** python3 run.py
 * Running on http://0.0.0.0:80/

暫無
暫無

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

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