将 uWSGI 设置为带有金字塔的网络服务器(无 NGINX) [英] Setup uWSGI as webserver with pyramid (no NGINX)
问题描述
大多数可用的教程展示了如何使用上游 HTTP 服务器(如 NGINX)设置 uWSGI.但是 uWSGI 单独可以很好地充当路由器/代理/负载平衡器 - 请参阅 这个对于我的项目,此时我不想设置 NGINX,所以我开始探索通过 uWSGI 提供网页的选项.此处的答案显示了如何使用 Pyramid 进行设置.
Most of the available tutorials show how to set up uWSGI with an upstream HTTP server (like NGINX). But uWSGI alone can act beautifully as router/proxy/load-balancer - refer this For my project, I didn't want to setup NGINX at this moment so I started off exploring the option of serving webpages through uWSGI. The answer here shows how to set it up with Pyramid.
推荐答案
我正在使用 pyramid_mongodb 脚手架,我对其进行了修改以使其在 python3 上工作.有关详细信息,请参阅此处.假设我们有一个 Pyramid 项目(使用 pcreate -s pyramid_mongodb MyProject
创建).这里是development/production.ini中需要的uWSGI配置
I am using pyramid_mongodb scaffold, which I have modified to get it working on python3. See here for details.
Assuming that we have a Pyramid project (created with pcreate -s pyramid_mongodb MyProject
).
Here are the uWSGI configurations needed in development/production.ini
[uwsgi]
http = 0.0.0.0:8080
#http-to /tmp/uwsgi.sock - use this for standalone mode
#socket = :9050
master = true
processes = 2
harakiri = 60
harakiri-verbose = true
limit-post = 65536
post-buffering = 8192
daemonize = ./uwsgi.log
pidfile = ./orange_uwsgi.pid
listen = 128
max-requests = 1000
reload-on-as = 128
reload-on-rss = 96
no-orphans = true
#logto= <log file>
log-slow = true
virtualenv = <path to virtual environment>
#file = /path/to/pyramid.wsgi
#callable = application
need-app = true
此外,由于我们使用的是 uWSGI,我们可以从 ini 中注释掉 server
部分
Also since we are using uWSGI we can comment out server
portion from the ini
#[server:main]
#use = egg:waitress#main
#host = 0.0.0.0
#port = 6544
运行服务器使用uwsgi --ini-paste development.ini
这篇关于将 uWSGI 设置为带有金字塔的网络服务器(无 NGINX)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!