ubuntu+uwsgi+nginx+django手记

2015-12-08 10:39:00   技术   django nginx python ubuntu uwsgi

下面的安装都没测试,都是靠记忆,要是出问题我不负责

我只是因为AWS免费套餐到期,把里面的配置文件拉出来备份下

sudo apt-get install nginx
sudo apt-get install python-dev
sudo apt-get install uwsgi
sudo apt-get install uwsgi-plugin-python

uwsgi 测试

uwsgi --http-socket :9090 --plugin python --wsgi-file XXXX.py --process 3

各种配置文件链接

ln -s /home/XX/XX/XX/uwsgi.ini /etc/uwsgi/apps-enabled/

nginx同理

nginx配置

server {
    listen      80;
    server_name xx.xx.xx.xx;
    access_log  /home/ubuntu/nginx_conf/log/access.log;
    error_log   /home/ubuntu/nginx_conf/log/error.log;

    location /static {
        alias /home/xx/xx/xx/project/static;
    }

    location /test { #test去掉就是根目录
        include uwsgi_params;
        uwsgi_pass 127.0.0.1:9090;
        uwsgi_param UWSGI_SCRIPT django_wsgi;
        uwsgi_param SCRIPT_NAME /test;# test..
        uwsgi_modifier1 30;
        proxy_read_timeout 300;
        proxy_connect_timeout 300;
        proxy_redirect off;
    }
}

uwsgi配置

[uwsgi]
chdir           = /home/xx/project
module          = projectname.wsgi:application
master          = true
socket          = 127.0.0.1:9090
plugin          = python
process         = 4
chmod-socket    = 666
buffer-size     = 49152
threads         = 2
max-requests    = 6000
vacuum          = true
daemonize       = /home/xx/xx/xx/uwsgi.log
评论已关闭。
评论共