123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- [uwsgi]
- # 指定应用的用户(组)
- if-env=UWSGI_USER
- uid = $(UWSGI_USER)
- if-env = UWSGI_GROUP
- gid = $(UWSGI_GROUP)
- endif =
- # 监听的ip与端口
- http = :5000
- if-env = UWSGI_HTTP
- http = $(UWSGI_HTTP)
- endif =
- # PID文件
- pidfile = /var/run/nginx_agent.pid
- # 主入口模块
- module = app.webapp
- # 主入口函数
- callable = application
- # 需要关闭master,否则会导致进程中使用全局变量会出错
- master = true
- # 这个会导致不正常,待测试
- #async=128
- # 进程数
- processes = 10
- if-env = UWSGI_PROCESSES
- processes = $(UWSGI_PROCESSES)
- endif =
- # 运行多线程
- enable-threads = 0
- if-env = UWSGI_ENABLE_THREADS
- enable-threads = $(UWSGI_ENABLE_THREADS)
- endif =
- # http的线程数
- http-processes = 2
- if-env = UWSGI_HTTP_PROCESSES
- http-processes = $(UWSGI_HTTP_PROCESSES)
- endif =
- # 是否保持http连接
- http-keepalive = 0
- if-env = UWSGI_HTTP_KEEPALIVE
- http-keepalive = $(UWSGI_HTTP_KEEPALIVE)
- endif =
- # 超时关闭连接的时间(秒)
- harakiri = 200
- if-env = UWSGI_HARAKIRI
- harakiri = $(UWSGI_HARAKIRI)
- endif =
- # 打开http body缓冲
- if-env = UWSGI_POST_BUFFERING
- post-buffering = $(UWSGI_POST_BUFFERING)
- endif =
- # python解释器的优化,=0不优化
- if-env = UWSGI_PY_OPTIMIZE
- optimize = $(UWSGI_PY_OPTIMIZE)
- endif =
- # 关闭http请求的日志
- if-env = UWSGI_DISABLE_LOGGING
- disable-logging = $(UWSGI_DISABLE_LOGGING)
- endif =
- # 记录uwsgi自身的日志
- logto = /data/logs/nginx_agent_uwsgi.log
- # daemonize = /data/logs/nginx_agent.log
- # 等待其它进程重启(直到接收到的请求处理完才重启)/关闭的最大时间(秒)
- reload-mercy = 2
- # CPU亲和性
- cpu-affinity = 1
- # 进程的内存限制(address space/vsz)
- if-env = UWSGI_LIMIT_AS
- limit-as = $(UWSGI_LIMIT_AS)
- endif =
- # 占用内存(address space)大于指定值(MB),重启服务
- if-env = UWSGI_RELOAD_ON_AS
- reload-on-as = $(UWSGI_RELOAD_ON_AS)
- endif =
- # 占用内存(rss)大于指定值(MB),重启服务
- if-env = UWSGI_RELOAD_ON_RSS
- reload-on-rss = $(UWSGI_RELOAD_ON_RSS)
- endif =
- # 超过指定请求数,会创建新的进程
- if-env = UWSGI_MAX_REQUESTS
- max-requests = $(UWSGI_MAX_REQUESTS)
- endif =
- # 退出时清除环境(自动删除unix socket文件和pid文件)
- vacuum = true
- # python代码变化后自动重启服务,仅用用开发环境
- if-env = UWSGI_PY_AUTORELOAD
- py-autoreload = $(UWSGI_PY_AUTORELOAD)
- endif =
- # master进程关闭会自动杀死workers
- no-orphans = true
- # 设置socket的监听队列大小
- if-env = UWSGI_LISTEN
- listen = $(UWSGI_LISTEN)
- endif =
- # python包环境
- pythonpath=/work/nginx_agent/src
|