一、参数详解
指定一个配置文件(.py)
-c --config-
绑定socket
-b --bindgunicorn -b 127.0.0.1:8080 守护进程后台运行
-D --daemonworker的数量
-w --workers-
工作进程类型
-k工作进程类型包括: sync(default) eventlet gevent tornado gthread gaiohttp 最大挂起的连接数
--backlog切换到指定的工作目录
--chdir-
输出error log的颗粒度
--log-level有效颗粒度: debug info warning error critical 指定access日志文件
--access-logfile指定error日志文件
--error-logfile
二、部署
- 利用nginx反向代理
server {
listen 80;
server_name example.org;
access_log /var/log/nginx/example.log;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}