問題描述:uwsgi: command not found
[[email protected] home]# uwsgi --help
-bash: uwsgi: command not found
解決辦法:找到uwsgi執行位置,建立軟連結
[[email protected] home]# find / -name uwsgi
/usr/local/python27/bin/uwsgi
[[email protected] home]# ln -s /usr/local/python27/bin/uwsgi /usr/bin/uwsgi
軟連接配接起作用後:
[[email protected] home]# uwsgi --help
Usage: /usr/local/python27/bin/uwsgi [options...]
-s|--socket bind to the specified UNIX/TCP socket using default protocol
-s|--uwsgi-socket bind to the specified UNIX/TCP socket using uwsgi protocol
...
測試uwsgi是否正常運作
建立test.py檔案如下:
def application(env, start_response):
start_response('200 OK', [('Content-Type','text/html')])
return [b"Hello World"]
運作方式一:
uwsgi --http-socket :8088 --wsgi-file test.py
或 uwsgi --http :8001 --wsgi-file test.py
運作方式二:運作uwsgi.ini配置檔案,uwsgi --ini ./uwsgi.ini,配置檔案内容如下:
[uwsgi]
http-socket= :8088
chdir=/home/project
wsgi-file=test.py
通路均可得:

uwsgi出現invalid request block size: 21573 (max 4096)…skip解決辦法
buffer-size
uwsgi内部解析的資料包大小,預設4k。
如果準備接收大請求,你可以增長到64k。
允許uwsgi接收到32k,更大的會被丢棄。
uwsgi.ini配置如下:
[uwsgi]
socket = 127.0.0.1:8088
chdir = /home/project
wsgi-file = test.py
master = true
processes = 1
buffer-size = 65536
或者給uwsgi啟動指令加參數:uwsgi -b 8192