- 安装nginx
安装pip
yum install epel-release yum install python-pip
安装uwsgi
pip install uwsgi
配置nginx
#在server下的location下增加以下2行 location / { uwsgi_pass 127.0.0.1:9001; include uwsgi_params; }
设置后重启nginx
编写测试文件
# /var/www/python/index.py def application(env, start_response): start_response('200 OK', [('Content-Type','text/html; charset=iso-8859-1')]) return 'Hello, world'
启动uwsgi
uwsgi -s 127.0.0.1:9001 --wsgi-file /var/www/index.py
完成,测试。