我用类似的命令启动 gunicorngunicorn -c gunicorn.py main:app
内容gunicorn.py
为:
bind = "unix:/tmp/mysock.sock"
workers = 3
backlog = 2048
worker_class = "sync"
#worker_class = "gevent"
debug = False
daemon = True
pidfile = "/tmp/mypid.pid"
logfile = "/tmp/mylog.log"
user = 'www-data' # only under sudo
最后一行我无法使用上面的命令。如果我添加 sudo 并启动它sudo gunicorn -c gunicorn.py main:app
,主进程将从 root 运行,这对安全性不利。如何正确启动?