安装nginx python uwsgi环境 以及模拟测试

UWSGI配置与启动详解
本文档详细介绍了UWSGI的配置与启动方法,包括解决常见错误、配置自动重载、手动启动命令及参数说明,并提供了与Flask框架结合使用的实例。

uwsgi帮助文档:

http://uwsgi-docs-cn.readthedocs.io/zh_CN/latest/WSGIquickstart.html

http://uwsgi-docs.readthedocs.io/en/latest/Async.html

http://www.cnblogs.com/xiongpq/p/3381069.html

 

./configure: error: the HTTP rewrite module requires the PCRE library错误见下文

http://blog.youkuaiyun.com/hfsu0419/article/details/7190152

也可以参考廖雪峰的博客:

http://www.liaoxuefeng.com/article/001373892270040b645f6f886d94bdfbf57b8dd596f19b3000

 

uwsgi.ini中必须配置

py-autoreload = 1

否则程序修改不会生效,见文章:http://stackoverflow.com/questions/27813166/uwsgi-does-not-reload-after-changing-django-settings

 

手动命令启动uwsgi:

[root@crz_oa webserver]# uwsgi --http :9090 --wsgi-file home.py --daemonize /var/log/uwsgi.log

升级

[root@crz_oa webserver]# uwsgi --http :9090 --wsgi-file home.py --daemonize /var/log/uwsgi.log --master --harakiri 60 --socket-timeout 10

或者

[root@crz_oa webserver]# uwsgi -s 127.0.0.1:9090 --wsgi-file home.py --daemonize /var/log/uwsgi.log --master --harakiri 60 --socket-timeout 10

然后结合nginx通过socket接口调用

 

版本2 结合flask使用命令:

[root@crz_oa webserver]# uwsgi --http :9090 --wsgi-file home.py --daemonize /var/log/uwsgi.log --master --harakiri 60 --socket-timeout 10 -w home:app

参考http://docs.jinkan.org/docs/flask/deploying/uwsgi.html

 

如果出现错误:

uwsgi: option '--http' is ambiguous

换成这种写法

uwsgi --http-socket :9090 --wsgi-file home.py --daemonize /var/log/uwsgi.log --master --harakiri 60 --socket-timeout 10 -w home:app

囧,接着又出现错误:

uwsgi: unrecognized option '--wsgi-file'

sudo uwsgi --http-socket :9090 --plugin python  --wsgi-file home.py --daemonize /var/log/uwsgi.log --master --harakiri 60 --socket-timeout 10 -w home:app

 

模拟测试可以去这个网站http://coolaf.com/,不仅可以模拟post提交,还可以添加各种cookie参数和header参数,以及各种代理:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值