2014年8月1日 星期五

uWSGI and Nginx

  1. uwsgi --socket /tmp/uwsgi.sock -w Flask:app --chmod-socket=666
  2. /etc/nginx/site-enable/
  3. # mysite_nginx.conf

    # the upstream component nginx needs to connect to
    upstream flask {
        server unix:///tmp/uwsgi.sock;
    }

    # configuration of the server
    server {
        # the port your site will be served on
        listen      7777;
        # the domain name it will serve for
        server_name PinLiang.example.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 /home/pinliang/Restful/Money/media;  # your Django project's media files - amend as required
        }

        location /static {
            alias /home/pinliang/Restful/Money/static; # your Django project's static files - amend as required
        }

        # Finally, send all non-media requests to the Django server.
        location / {
            uwsgi_pass  flask;
            include     /home/pinliang/Restful/Money/uwsgi_params; # the uwsgi_params file you installed
        }
    }
  4. [uwsgi]
    chdir = /home/pinliang
    module = Flask
    callable = app
    master = true
    processes = 1
    socket = /tmp/uwsgi.sock
    chmod-socket = 666
    vacuum = true

沒有留言:

張貼留言