nginx+uwsgi配置
  1. 安装nginx
  2. 安装pip

    yum install epel-release
    yum install python-pip
  3. 安装uwsgi

    pip install uwsgi
  4. 配置nginx

    #在server下的location下增加以下2行
    location / {
        uwsgi_pass 127.0.0.1:9001;
        include uwsgi_params;
    }

    设置后重启nginx

  5. 编写测试文件

    # /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'
  6. 启动uwsgi

    uwsgi -s 127.0.0.1:9001 --wsgi-file /var/www/index.py

完成,测试。

添加新评论