首页 > 代码库 > centos和redhat下 uwsgi配置

centos和redhat下 uwsgi配置

1、下载最新稳定版uwsgi,地址为: wget http://projects.unbit.it/downloads/uwsgi-1.9.13.tar.gz

2、解压 tar zxvf uwsgi-1.9.13.tar.gz

3、cd uwsgi-1.9.13 && make

4、移动uwsgi到bin目录,方便调用 mv ./uwsgi /usr/bin

5、进入用户目录建立projectname.ini文件,内容为:
[uwsgi]
socket = 127.0.0.1:3031
chdir = /home/foobar/myproject/
pythonpath = ..
env = DJANGO_SETTINGS_MODULE=myproject.settings
module = django.core.handlers.wsgi:WSGIHandler()
processes = 4
threads = 2
stats = 127.0.0.1:9191

6、配置nginx
cd /etc/nginx/conf.d vi projectname.ini 输入以下内容:
server {
listen 80;
server_name: www.domain.com
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:3031;
}
}

7、重启nginx service nginx restart

8、uwsgi 用户目录/projectname.ini