美文网首页
django+nginx+uwsgi部署到对应domain

django+nginx+uwsgi部署到对应domain

作者: Leo_23 | 来源:发表于2018-10-10 19:14 被阅读23次

一定不要忘记 server_name .heystarlight.com;中的那个 .

  1. hey_star_nginx.conf
# mysite_nginx.conf

# the upstream component nginx needs to connect to
upstream django {
     server unix:///opt/hey_star/hey_star.sock; # for a file socket
     # server 127.0.0.1:8088; # 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 .heystarlight.com; # substitute your machine's IP address or FQDN
    charset     utf-8;

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

    # Django media
    location /media  {
        alias /opt/hey_star/media;  # your Django project's media files - amend as required
    }

    location /static {
        alias /opt/hey_star/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     /opt/hey_star/uwsgi_params; # the uwsgi_params file you installed
    }
}


2.hey_star_uwsgi.ini

# mysite_uwsgi.ini file
[uwsgi]

# Django-related settings
# the base directory (full path)
chdir           = /opt/hey_star
# Django's wsgi file
module          = hey_star.wsgi
# the virtualenv (full path)
home            = /opt/hey_star/hey_star/

# process-related settings
# master
master          = true
# maximum number of worker processes
processes       = 10
# the socket (use the full path to be safe
socket          = /opt/hey_star/hey_star.sock
# ... with appropriate permissions - may be needed
chmod-socket    = 666
# clear environment on exit
vacuum          = true

daemonize = /var/log/uwsgi/hey_star.log

3.输入命令拉起django

uwsgi --ini hey_star_uwsgi.ini

相关文章

网友评论

      本文标题:django+nginx+uwsgi部署到对应domain

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