我的网站已经运行了大约1。5年。我偶尔会遇到间歇性断电,这需要我重新启动nginx和gunicorn。大约1.5个月前我的服务器空间不足,同样需要我清理一些空间并重启nginx / gunicorn。
在每种情况下,我都遇到了502 Bad Gateway错误,但重启nginx / gunicorn解决了这个问题。
然而,我再次面临502 Bad Gateway错误,但重新启动服务器不起作用。相反,我在运行以下命令时遇到以下问题:
/var/www/sonification/sonification/venv/bin/gunicorn --bind 127.0.0.1:5001 --worker-class socketio.sgunicorn.GeventSocketIOWorker sonification:app
我的服务器配置没有变化。一切都过去了!我甚至不知道调试这样的事情的第一步。有什么指针吗?
user@site:/var/www/sonification/sonification$ source venv/bin/activate
(venv)user@site:/var/www/sonification/sonification$ pip freeze
/var/www/sonification/sonification/venv/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
You are using pip version 7.0.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Flask==0.10.1
Flask-Bootstrap==3.3.4.1
Flask-SocketIO==0.6.0
gevent==1.0.2
gevent-socketio==0.3.6
gevent-websocket==0.9.3
greenlet==0.4.7
gunicorn==18.0
itsdangerous==0.24
Jinja2==2.7.3
MarkupSafe==0.23
uWSGI==2.0.10
Werkzeug==0.10.4
wheel==0.24.0
(venv)user@site:/var/www/sonification/sonification$ gunicorn --bind 127.0.0.1:5002 --worker-class socketio.sgunicorn.GeventSocketIOWorker sonification:app
2017-06-28 14:59:45 [23115] [INFO] Starting gunicorn 18.0
2017-06-28 14:59:45 [23115] [INFO] Listening at: http://127.0.0.1:5002 (23115)
2017-06-28 14:59:45 [23115] [INFO] Using worker: socketio.sgunicorn.GeventSocketIOWorker
2017-06-28 14:59:45 [23120] [INFO] Booting worker with pid: 23120
2017-06-28 14:59:45 [23120] [ERROR] Exception in worker process:
Traceback (most recent call last):
File "/var/www/sonification/sonification/venv/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
worker.init_process()
File "/var/www/sonification/sonification/venv/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
self.wsgi = self.app.wsgi()
File "/var/www/sonification/sonification/venv/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi
self.callable = self.load()
File "/var/www/sonification/sonification/venv/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 62, in load
return self.load_wsgiapp()
File "/var/www/sonification/sonification/venv/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
return util.import_app(self.app_uri)
File "/var/www/sonification/sonification/venv/local/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app
__import__(module)
ImportError: No module named sonification
Traceback (most recent call last):
File "/var/www/sonification/sonification/venv/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
worker.init_process()
File "/var/www/sonification/sonification/venv/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
self.wsgi = self.app.wsgi()
File "/var/www/sonification/sonification/venv/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi
self.callable = self.load()
File "/var/www/sonification/sonification/venv/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 62, in load
return self.load_wsgiapp()
File "/var/www/sonification/sonification/venv/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
return util.import_app(self.app_uri)
File "/var/www/sonification/sonification/venv/local/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app
__import__(module)
ImportError: No module named sonification
2017-06-28 14:59:45 [23120] [INFO] Worker exiting (pid: 23120)
2017-06-28 14:59:45 [23115] [INFO] Shutting down: Master
2017-06-28 14:59:45 [23115] [INFO] Reason: Worker failed to boot.
还尝试过:
user@site:/var/cache$ /var/www/sonification/sonification/venv/bin/gunicorn --bind 127.0.0.1:5001 --worker-class socketio.sgunicorn.GeventSocketIOWorker sonification:app
2017-06-25 16:51:12 [6352] [INFO] Starting gunicorn 18.0
2017-06-25 16:51:12 [6352] [INFO] Listening at: http://127.0.0.1:5001 (6352)
2017-06-25 16:51:12 [6352] [INFO] Using worker: socketio.sgunicorn.GeventSocketIOWorker
2017-06-25 16:51:12 [6357] [INFO] Booting worker with pid: 6357
2017-06-25 16:51:12 [6357] [ERROR] Exception in worker process:
Traceback (most recent call last):
File "/var/www/sonification/sonification/venv/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
worker.init_process()
File "/var/www/sonification/sonification/venv/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
self.wsgi = self.app.wsgi()
File "/var/www/sonification/sonification/venv/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi
self.callable = self.load()
File "/var/www/sonification/sonification/venv/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 62, in load
return self.load_wsgiapp()
File "/var/www/sonification/sonification/venv/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
return util.import_app(self.app_uri)
File "/var/www/sonification/sonification/venv/local/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app
__import__(module)
ImportError: No module named sonification
Traceback (most recent call last):
File "/var/www/sonification/sonification/venv/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
worker.init_process()
File "/var/www/sonification/sonification/venv/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
self.wsgi = self.app.wsgi()
File "/var/www/sonification/sonification/venv/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi
self.callable = self.load()
File "/var/www/sonification/sonification/venv/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 62, in load
return self.load_wsgiapp()
File "/var/www/sonification/sonification/venv/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
return util.import_app(self.app_uri)
File "/var/www/sonification/sonification/venv/local/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app
__import__(module)
ImportError: No module named sonification
2017-06-25 16:51:12 [6357] [INFO] Worker exiting (pid: 6357)
2017-06-25 16:51:12 [6352] [INFO] Shutting down: Master
2017-06-25 16:51:12 [6352] [INFO] Reason: Worker failed to boot.