uwsgi.ini 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. [uwsgi]
  2. # 指定应用的用户(组)
  3. if-env=UWSGI_USER
  4. uid = $(UWSGI_USER)
  5. if-env = UWSGI_GROUP
  6. gid = $(UWSGI_GROUP)
  7. endif =
  8. # 监听的ip与端口
  9. http = :5000
  10. if-env = UWSGI_HTTP
  11. http = $(UWSGI_HTTP)
  12. endif =
  13. # PID文件
  14. pidfile = /var/run/nginx_agent.pid
  15. # 主入口模块
  16. module = app.webapp
  17. # 主入口函数
  18. callable = application
  19. # 需要关闭master,否则会导致进程中使用全局变量会出错
  20. master = true
  21. # 这个会导致不正常,待测试
  22. #async=128
  23. # 进程数
  24. processes = 10
  25. if-env = UWSGI_PROCESSES
  26. processes = $(UWSGI_PROCESSES)
  27. endif =
  28. # 运行多线程
  29. enable-threads = 0
  30. if-env = UWSGI_ENABLE_THREADS
  31. enable-threads = $(UWSGI_ENABLE_THREADS)
  32. endif =
  33. # http的线程数
  34. http-processes = 2
  35. if-env = UWSGI_HTTP_PROCESSES
  36. http-processes = $(UWSGI_HTTP_PROCESSES)
  37. endif =
  38. # 是否保持http连接
  39. http-keepalive = 0
  40. if-env = UWSGI_HTTP_KEEPALIVE
  41. http-keepalive = $(UWSGI_HTTP_KEEPALIVE)
  42. endif =
  43. # 超时关闭连接的时间(秒)
  44. harakiri = 200
  45. if-env = UWSGI_HARAKIRI
  46. harakiri = $(UWSGI_HARAKIRI)
  47. endif =
  48. # 打开http body缓冲
  49. if-env = UWSGI_POST_BUFFERING
  50. post-buffering = $(UWSGI_POST_BUFFERING)
  51. endif =
  52. # python解释器的优化,=0不优化
  53. if-env = UWSGI_PY_OPTIMIZE
  54. optimize = $(UWSGI_PY_OPTIMIZE)
  55. endif =
  56. # 关闭http请求的日志
  57. if-env = UWSGI_DISABLE_LOGGING
  58. disable-logging = $(UWSGI_DISABLE_LOGGING)
  59. endif =
  60. # 记录uwsgi自身的日志
  61. logto = /data/logs/nginx_agent_uwsgi.log
  62. # daemonize = /data/logs/nginx_agent.log
  63. # 等待其它进程重启(直到接收到的请求处理完才重启)/关闭的最大时间(秒)
  64. reload-mercy = 2
  65. # CPU亲和性
  66. cpu-affinity = 1
  67. # 进程的内存限制(address space/vsz)
  68. if-env = UWSGI_LIMIT_AS
  69. limit-as = $(UWSGI_LIMIT_AS)
  70. endif =
  71. # 占用内存(address space)大于指定值(MB),重启服务
  72. if-env = UWSGI_RELOAD_ON_AS
  73. reload-on-as = $(UWSGI_RELOAD_ON_AS)
  74. endif =
  75. # 占用内存(rss)大于指定值(MB),重启服务
  76. if-env = UWSGI_RELOAD_ON_RSS
  77. reload-on-rss = $(UWSGI_RELOAD_ON_RSS)
  78. endif =
  79. # 超过指定请求数,会创建新的进程
  80. if-env = UWSGI_MAX_REQUESTS
  81. max-requests = $(UWSGI_MAX_REQUESTS)
  82. endif =
  83. # 退出时清除环境(自动删除unix socket文件和pid文件)
  84. vacuum = true
  85. # python代码变化后自动重启服务,仅用用开发环境
  86. if-env = UWSGI_PY_AUTORELOAD
  87. py-autoreload = $(UWSGI_PY_AUTORELOAD)
  88. endif =
  89. # master进程关闭会自动杀死workers
  90. no-orphans = true
  91. # 设置socket的监听队列大小
  92. if-env = UWSGI_LISTEN
  93. listen = $(UWSGI_LISTEN)
  94. endif =
  95. # python包环境
  96. pythonpath=/work/nginx_agent/src