django uwsgi
uwsgi.ini
[uwsgi] socket =/data/projects/rookie/script/uwsgi.sock # django project root path chdir = /data/projects/rookie # wsgi path wsgi-file = rookie/wsgi.py module=rookie.wsgi:application processes = 4 threads = 2 stats = 192.168.110.151:8002 # if service stopped auto removed unix socket and pid file vacuum = true # uwsgi log path #daemonize = uwsgi.log # mean only record error log and not record normal log disable-logging = true # run service with which user and group of linux uid = root gid = root # uwsgi.pid path and default uwsgi.ini same dir pidfile=uwsgi.pid # the buffer-size limit max size buffer-size = 65536 # max requests amount max-requests=5000 # queue-size of listen listen= 200 # limit uwsgi progress virtual mem usage size is 6048M limit-as =6048 env = LANG=en_US.UTF-8 # venv path home=/usr/local/bin/venv # drop request and recycle progress of request after 60 seconds not response harakiri = 60
nginx.conf
worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name 192.168.110.151; location / { root /data/projects/rookie; uwsgi_pass unix:/data/projects/rookie/script/uwsgi.sock ; include uwsgi_params; } location /static { alias /data/projects/rookie/static; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
参考文章:
https://uwsgi-docs.readthedocs.io/en/latest/Nginx.html
https://docs.djangoproject.com/zh-hans/3.0/howto/deployment/wsgi/uwsgi/