uwsgi模式 uwsgi配置詳解

2021-10-12 13:23:01 字數 1634 閱讀 1220

#啟動:uwsgi uwsgi.ini

#停止: uwsgi --stop uwsgi.pid

[uwsgi]

# 對外提供 http 服務的埠

#the local unix socket file than commnuincate to nginx 用於和 nginx 進行資料互動的埠

socket = 127.0.0.1:8001

# the base directory (full path) django 程式的主目錄

chdir =/home/opadm/mms_webserver/src

# django's wsgi file

wsgi-file =src/wsgi.py

# maximum number of worker processes

processes = 100

#thread numbers startched in each worker process

threads = 10

#乙個高階的cheap模式,在啟動的時候只會分配n個工作程序,並使用自適應演算法啟動新的程序

cheaper = 10

#在經過sec秒的不活躍狀態的程序會被銷毀(進入了cheap模式),並最少保留cheaper指定的程序數

idle = 3600

#monitor uwsgi status 通過該埠可以監控 uwsgi 的負載情況

stats = 127.0.0.1:9000

#設定乙個請求的超時時間(秒),如果乙個請求超過了這個時間,則請求被丟棄

harakiri = 60

#當乙個請求被harakiri殺掉會,會輸出一條日誌

harakiri-verbose = true

#開啟記憶體使用情況報告

memory-report = true

#設定平滑的重啟(直到處理完接收到的請求)的長等待時間(秒)

reload-mercy = 10

#設定工作程序使用虛擬記憶體超過n mb就**重啟

reload-on-as= 1024

#自動給程序命名

auto-procname = true

#為程序指定字首

procname-prefix-spaced = xc-mms

#設定工作程序每處理n個程序就會被**重啟

max-requests=500000

#設定工作程序使用物理記憶體超過n mb就**重啟

reload-on-rss=100

#設定socket超時時間,預設4秒

socket-timeout=10

#限制http請求體的大小(bytes)

limit-post=4096

# clear environment on exit

vacuum = true

#不記錄request日誌,只記錄錯誤日誌

disable-logging = true

#將日誌列印到syslog上

#log-syslog = true

# 後台執行,並輸出日誌

daemonize = /home/opadm/log/uwsgi.log

stats=./uwsgi.status

uwsgi基本配置

uwsgi django related settings django專案本地埠 socket 0.0.0.0 8000 專案根目錄位置 chdi root myplatform wsgi.py檔案在專案的中的相對位置 wsgi file myplatform wsgi.py module myp...

uwsgi配置詳解

先啟用virtualenv 啟動 uwsgi uwsgi.ini 停止 uwsgi stop uwsgi.pid uwsgi 對外提供 http 服務的埠 the local unix socket file than commnuincate to nginx 用於和 nginx 進行資料互動的埠...

安裝uwsgi和使用uwsgi

部落格說明 安裝依賴apt get install build essential python dev安裝 uwsgi 使用python3的pip來安裝 pip3 install uwsgi建立配置檔案 建立類似配置檔案,uwsgi.ini uwsgi socket 127.0.0.1 3031 ...