我已经用ec2-12-34-567-89.us-west-2.compute.amazonaws.com.的DNS启动了一个Amazonec2实例。在那里,我设置了一个安全组,其中type=HTTP、protocol=TCP、端口range=80,source=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发布于 2014-09-25 08:18:51
显然,我需要以超级用户的身份运行我的代码。
$ **sudo** python3 run.py
* Running on http://0.0.0.0:80/https://stackoverflow.com/questions/26031700
复制相似问题