一、参数详解
-
指定一个配置文件(.py)
-c --config
-
绑定socket
-b --bind
gunicorn -b 127.0.0.1:8080
-
守护进程后台运行
-D --daemon
-
worker的数量
-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;
}
}
网友评论