[uwsgi]
http-socket = :80 ;指定項目執行的端口號--nginx用socket,直接運行用http
listen = 1024 ;設置socket監聽隊列大小
plugin = python3 ;使用插件-編程語言
chdir = /code/project ;指定項目目錄
process = 8 ;開啓進程數量
enable-threads = 8 ;允許用內嵌的語言啓動線程;這將允許你在app程序中產生一個子線程
max-requests = 8192 ;設置每個進程請求數上限
harakiri = 60 ;請求超時時長.請求超時,該工作進程就會被回收重啓(重用)
master = true ; 允許主線程存在
die-on-term = true ;
log-x-forwarded-for = true
log-format-strftime = true
log-date = %%Y-%%m-%%d %%H:%%M:%%S ;日誌時間
log-format = UWSGI: %(ftime) %(addr) %(method) %(uri) %(status) %(size) %(msecs) %(uagent) ;日誌格式
daemonize = /code/app_web.log ;進程後臺運行,並將日誌打印到指定的文件
nwsgi-file = project/wsgi.py ;uwsgi日誌文件
pidfile = /uwsgi.pid ;指定pid文件
啓動命令: uwsgi --ini uwsgin.ini
重啓命令: uwsgi --reload uwsgi.pid
關閉命令: uwsgi --stop uwsgi.pid
實時狀態: uwsgi --connect-and-read uwsgi/uwsgi.status
linux自動配置命令:
echo -e "[uwsgi]\nhttp-socket = :80\nlisten = 1024\nplugin = python3\nlisten = 1024\nchdir = ${WORK_DIR}\nprocesses = ${UWSGI_PROCESSES}\nenable-threads = true\nthreads = 8\nmax-request = 8192\nharakiri = 60\nmaster = true\ndie-on-term = true\nlog-x-forwarded-for = true\nlog-format-strftime = true\nlog-date = %%Y-%%m-%%d %%H:%%M:%%S\nlog-format = UWSGI: %(ftime) %(addr) %(method) %(uri) %(status) %(size) %(msecs) %(uagent)\ndaemonize = /code/app_web.log\nwsgi-file = ${WSGI_FILE}\npidfile = /uwsgi.pid"> /uwsgi.ini curl