【原创】django配置nginx+uwsgi

2020-01-15  本文已影响0人  逢高_4882
[uwsgi]
socket=mhwl.sock
chdir=/root/mysite/mhwl
wsgi-file=mhwl/wsgi.py
process=4
threads=2
master=True
vacuum=True
pidfile=uwsgi.pid
daemonize=uwsgi.log
plugins = python3

upstream django {
    server unix:///root/mysite/mhwl/mhwl.sock; # for a file socket
    #server 127.0.0.1:8000; # for a web port socket (we'll use this first)
}

# configuration of the server
server {
    # the port your site will be served on
    listen      81;
    # the domain name it will serve for
    server_name localhost; # substitute your machine's IP address or FQDN
    charset     utf-8;

    # max upload size
    client_max_body_size 5120M;   # adjust to taste

    location /static {
        alias /root/mysite/mhwl/static; # your Django project's static files - amend as required
    }

    # Finally, send all non-media requests to the Django server.
    location / {
        uwsgi_pass  django;
        include     /root/mysite/mhwl/uwsgi_params; # the uwsgi_params file you installed
    }
}

上一篇 下一篇

猜你喜欢

热点阅读