gpt4 book ai didi

python - 在 AWS EC2 上部署 django 应用程序时无法在端口 80 上运行 gunicorn

转载 作者:太空狗 更新时间:2023-10-30 01:37:49 43 4
gpt4 key购买 nike

我在我的 EC2 AWS 中运行 Ubuntu 14.04 实例。

我可以运行 gunicorn -b 0.0.0.0:8000 myapp.wsgi

但是80端口运行失败

gunicorn -b 0.0.0.0:80 myapp.wsgi --> 失败

我试着遵循这个答案(虽然我无法理解,什么是部署脚本?)Getting Gunicorn to run on port 80

但是没有用。

我也尝试过以提升的权限 sudo 运行它,但没有成功。在 80 端口运行时出错:

ubuntu@ip-172-31-39-159:~/jeequery$ gunicorn -b 0.0.0.0:80 rubiks.wsgi
[2015-08-30 15:58:10 +0000] [6772] [INFO] Starting gunicorn 19.3.0
[2015-08-30 15:58:10 +0000] [6772] [ERROR] Retrying in 1 second.
[2015-08-30 15:58:11 +0000] [6772] [ERROR] Retrying in 1 second.
[2015-08-30 15:58:12 +0000] [6772] [ERROR] Retrying in 1 second.
[2015-08-30 15:58:13 +0000] [6772] [ERROR] Retrying in 1 second.
[2015-08-30 15:58:14 +0000] [6772] [ERROR] Retrying in 1 second.
[2015-08-30 15:58:15 +0000] [6772] [ERROR] Can't connect to ('0.0.0.0', 80)

在使用 sudo 运行时出现此错误:

ubuntu@ip-172-31-39-159:~$ gunicorn -b 0.0.0.0:80 rubiks.wsgi
[2015-08-30 16:48:09 +0000] [6943] [INFO] Starting gunicorn 19.3.0
[2015-08-30 16:48:09 +0000] [6943] [ERROR] Retrying in 1 second.
[2015-08-30 16:48:10 +0000] [6943] [ERROR] Retrying in 1 second.
[2015-08-30 16:48:11 +0000] [6943] [ERROR] Retrying in 1 second.
^C[2015-08-30 16:48:12 +0000] [6943] [ERROR] Retrying in 1 second.
[2015-08-30 16:48:13 +0000] [6943] [ERROR] Retrying in 1 second.
[2015-08-30 16:48:14 +0000] [6943] [ERROR] Can't connect to ('0.0.0.0', 80)
ubuntu@ip-172-31-39-159:~$ ^C
ubuntu@ip-172-31-39-159:~$ sudo gunicorn -b 0.0.0.0:80 rubiks.wsgi
[2015-08-30 16:48:21 +0000] [6947] [INFO] Starting gunicorn 19.3.0
[2015-08-30 16:48:21 +0000] [6947] [INFO] Listening at: http://0.0.0.0:80 (6947)
[2015-08-30 16:48:21 +0000] [6947] [INFO] Using worker: sync
[2015-08-30 16:48:21 +0000] [6950] [INFO] Booting worker with pid: 6950
[2015-08-30 16:48:21 +0000] [6950] [ERROR] Exception in worker process:
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/gunicorn/arbiter.py", line 507, in spawn_worker
worker.init_process()
File "/usr/local/lib/python3.4/dist-packages/gunicorn/workers/base.py", line 118, in init_process
self.wsgi = self.app.wsgi()
File "/usr/local/lib/python3.4/dist-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/usr/local/lib/python3.4/dist-packages/gunicorn/app/wsgiapp.py", line 65, in load
return self.load_wsgiapp()
File "/usr/local/lib/python3.4/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
return util.import_app(self.app_uri)
File "/usr/local/lib/python3.4/dist-packages/gunicorn/util.py", line 355, in import_app
__import__(module)
ImportError: No module named 'rubiks'
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/gunicorn/arbiter.py", line 507, in spawn_worker
worker.init_process()
File "/usr/local/lib/python3.4/dist-packages/gunicorn/workers/base.py", line 118, in init_process
self.wsgi = self.app.wsgi()
File "/usr/local/lib/python3.4/dist-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/usr/local/lib/python3.4/dist-packages/gunicorn/app/wsgiapp.py", line 65, in load
return self.load_wsgiapp()
File "/usr/local/lib/python3.4/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
return util.import_app(self.app_uri)
File "/usr/local/lib/python3.4/dist-packages/gunicorn/util.py", line 355, in import_app
__import__(module)
ImportError: No module named 'rubiks'
[2015-08-30 16:48:21 +0000] [6950] [INFO] Worker exiting (pid: 6950)
[2015-08-30 16:48:21 +0000] [6947] [INFO] Shutting down: Master
[2015-08-30 16:48:21 +0000] [6947] [INFO] Reason: Worker failed to boot.

最佳答案

**您似乎还没有将端口 80 添加到您的安全组..

此外,您还必须在访问端口 80 的命令之前使用 sudo

希望对您有所帮助**

关于python - 在 AWS EC2 上部署 django 应用程序时无法在端口 80 上运行 gunicorn,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32298481/

43 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com