美文网首页Python Developer
Nginx + Uwsgi的基础配置

Nginx + Uwsgi的基础配置

作者: minhelloworld | 来源:发表于2018-07-26 10:11 被阅读15次

Nginx 配置文件:

# mysite_nginx.conf
  
# the upstream component nginx needs to connect to
upstream django {
    # server unix:///path/to/your/mysite/mysite.sock; # for a file socket
    server 127.0.0.1:8082; # for a web port socket (we'll use this first)
}

# configuration of the server
server {
    # the port your site will be served on
    listen      80;
    # 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 75M;   # adjust to taste

    # Django static
    Location ^~/static/ {
        alias /root/mysite/static_common/; # 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/uwsgi_params; # the uwsgi_params file you installed
    }
}

Uwsgi配置文件:

[uwsgi]
# Django-related settings

socket = 127.0.0.1:8082         #此处重点,单独的Uwsgi配置使用http

# the base directory (full path)
chdir = /root/mysite


# Django s wsgi file
module = mysite.wsgi

# process-related settings
# master
master = true

# maximum number of worker processes
processes = 1

# ... with appropriate permissions - may be needed
# chmod-socket    = 664
# clear environment on exit
vacuum = true

相关文章

网友评论

    本文标题:Nginx + Uwsgi的基础配置

    本文链接:https://www.haomeiwen.com/subject/iebvmftx.html