有关此主题的问题很多,但没有一个对我有帮助。
我正在尝试将Gunicorn连接到其中,/tmp/gunicorn.sock但我继续前进operation not permitted。我的gunicorn.conf.py样子是:
import multiprocessing
# bind = '127.0.0.1:5000'
bind = 'unix:/tmp/gunicorn.sock'
backlog = 2048
preload_app = True
max_requests = 2048
max_requests_jitter = 128
workers = multiprocessing.cpu_count() * 2 + 1
worker_connections = 1000
timeout = 60
keepalive = 2
errorlog = '-'
loglevel = 'debug'
accesslog = '-'
access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'
def when_ready(server):
open('/tmp/app-initialized', 'w').close()
和我的日志是:
[2018-08-03 02:34:40 +0000] [116] [INFO] Starting gunicorn 19.9.0
[2018-08-03 02:34:40 +0000] [116] [DEBUG] connection to /tmp/gunicorn.sock failed: [Errno 1] Operation not permitted
[2018-08-03 02:34:40 +0000] [116] [ERROR] Retrying in 1 second.
[2018-08-03 02:34:41 +0000] [116] [DEBUG] connection to /tmp/gunicorn.sock failed: [Errno 1] Operation not permitted
[2018-08-03 02:34:41 +0000] [116] [ERROR] Retrying in 1 second.
[2018-08-03 02:34:42 +0000] [116] [DEBUG] connection to /tmp/gunicorn.sock failed: [Errno 1] Operation not permitted
[2018-08-03 02:34:42 +0000] [116] [ERROR] Retrying in 1 second.
[2018-08-03 02:34:43 +0000] [116] [DEBUG] connection to /tmp/gunicorn.sock failed: [Errno 1] Operation not permitted
[2018-08-03 02:34:43 +0000] [116] [ERROR] Retrying in 1 second.
[2018-08-03 02:34:44 +0000] [116] [DEBUG] connection to /tmp/gunicorn.sock failed: [Errno 1] Operation not permitted
[2018-08-03 02:34:44 +0000] [116] [ERROR] Retrying in 1 second.
[2018-08-03 02:34:45 +0000] [116] [ERROR] Can't connect to /tmp/gunicorn.sock
对于用户来说,这看起来像是权限错误,但这应该不是问题,因为gunicorn它以root
/opt/app # ps aux | grep gunicorn
123 root 0:00 grep gunicorn
我也尝试过创建一个用户和一个组,addgroup -S appgroup && adduser -S appuser -G appgroup并/tmp/通过这样做来更改文件夹的权限chown appuser:appgroup /tmp/(因为gunicorn.sock未创建文件)。
操作系统中的内容正在按原样执行root,但仍然出现此错误。如何使通过gunicorn.sock文件运行它成为可能?
Helenr
相关分类