gunicorn状态
gunicorn.service - gunicorn daemon
Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled; vendor
Active: failed (Result: exit-code) since Mon 2018-03-12 18:30:15 UTC;
Process: 3535 ExecStart=/home/mike/movingcollage/movingcollageenv/bin/
Main PID: 3535 (code=exited, status=1/FAILURE)
Mar 12 18:30:15 ubuntu-2gb-nyc3-01 gunicorn[3535]: File "/home/mike/mo
Mar 12 18:30:15 ubuntu-2gb-nyc3-01 gunicorn[3535]: time.sleep(0.1)
Mar 12 18:30:15 ubuntu-2gb-nyc3-01 gunicorn[3535]: File "/home/mike/mo
Mar 12 18:30:15 ubuntu-2gb-nyc3-01 gunicorn[3535]: self.reap_workers
Mar 12 18:30:15 ubuntu-2gb-nyc3-01 gunicorn[3535]: File "/home/mike/mo
Mar 12 18:30:15 ubuntu-2gb-nyc3-01 gunicorn[3535]: raise HaltServer(
Mar 12 18:30:15 ubuntu-2gb-nyc3-01 gunicorn[3535]: gunicorn.errors.HaltS
Mar 12 18:30:15 ubuntu-2gb-nyc3-01 systemd[1]: gunicorn.service: Main pr
Mar 12 18:30:15 ubuntu-2gb-nyc3-01 systemd[1]: gunicorn.service: Unit en
Mar 12 18:30:15 ubuntu-2gb-nyc3-01 systemd[1]: gunicorn.service: Failed
29 ubuntu-2gb-nyc3-01 systemd[1]: gunicorn.service: Failed
nginx错误日志:
2018/03/12 04:59:08 [error] 1562#1562: *1787 connect() to unix:/home/mik
e/movingcollage/movingcollage.sock failed (111: Connection refused) whil
e connecting to upstream, client: 107.205.110.154, server: movingcollage
.com, request: "GET / HTTP/1.1", upstream: "http://unix:/home/mike/movin
gcollage/movingcollage.sock:/", host: "movingcollage.com"
我的配置还可以,以前用过;我提取了一些新的应用程序代码,现在我遇到了502错误的网关错误(在我提取应用程序代码之前,网站工作正常)。我已经service gunicorn restart
和systemctl restart gunicorn
,但仍然遇到502错误的网关错误。有人可以帮忙吗?
这是一个django项目,值得它。
Gunicorn配置:
description "Gunicorn application server handling movingcollage"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
setuid user
setgid www-data
chdir /home/mike/movingcollage
exec movingcollageenv/bin/gunicorn --workers 3 --bind unix:/home/mike/movingcollage/movingcollage.sock movingcollage.wsgi:application
gunicorn --bind = unix:/home/mike/movingcollage/movingcollage.sock movingcollage.wsgi.application
root@ubuntu-2gb-nyc3-01:/etc/init# gunicorn --bind=unix:/home/mike/movingcollage/movingcollage.sock movingcollage.wsgi:application
Traceback (most recent call last):
File "/usr/local/bin/gunicorn", line 11, in <module>
sys.exit(run())
File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py",
line 74, in run
WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/base.py", li
ne 185, in run
super(Application, self).run()
File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/base.py", li
ne 71, in run
Arbiter(self).run()
File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", lin
e 169, in run
self.manage_workers()
File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", lin
e 477, in manage_workers
self.spawn_workers()
File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", lin
e 542, in spawn_workers
time.sleep(0.1 * random.random())
File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", lin
e 209, in handle_chld
self.reap_workers()
File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", lin
e 459, in reap_workers
raise HaltServer(reason, self.WORKER_BOOT_ERROR)
gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
答案 0 :(得分:0)
在解决导入错误后运行gunicorn --bind=unix:/home/mike/movingcollage/movingcollage.sock movingcollage.wsgi:application --preload --loglevel=debug
并使其保持运行