简体   繁体   English

nginx和uwsgi服务器中的uwsgi模块之间的区别

[英]difference between uwsgi module in nginx and uwsgi server

I'm new to linux development. 我是linux开发的新手。 I'm a bit confused on the documentation i read. 我对我阅读的文档感到有点困惑。 My ultimate goal is to host a simple python backed web service that would examine an incoming payload, and forward it to other server. 我的最终目标是托管一个简单的python支持的Web服务,该服务将检查传入的有效负载,并将其转发到其他服务器。 This should be less than 30 lines of code in python. 这应该是python中少于30行的代码。

I'm planning to use nginx to serve up python file. 我打算用nginx来提供python文件。 From my research, i also need a python web framework. 根据我的研究,我还需要一个python web框架。 I chose to go with uwsgi. 我选择和uwsgi一起去。 I'm so confused. 我很困惑。 which one do I need? 我需要哪一个? an nginx uwsgi module, or uwsgi server? 一个nginx uwsgi模块,还是uwsgi服务器? i don't want to put django just for this simple purpose. 我不想把django放在这个简单的目的上。

the nginx documentation mention that nginx文档提到了这一点

Do not confuse the uwsgi protocol with the uWSGI server (that speaks the uwsgi protocol) 不要将uwsgi协议与uWSGI服务器混淆(说uwsgi协议)

So, does that mean, i don't need to install uwsgi server separately? 那么,这是否意味着,我不需要单独安装uwsgi服务器? do i just install nginx, and start configuring? 我只是安装nginx,并开始配置? I'm using nginx 1.4.4 我正在使用nginx 1.4.4

Could someone share a step by step configuration procedure on how to configure uwsgi with nginx, along with a sample python code(hello world maybe)? 有人可以分享一步一步的配置程序,如何使用nginx配置uwsgi,以及示例python代码(也许你好世界)? i can configure nginx just fine, but i don't know how to make it serve python pages. 我可以配置nginx很好,但我不知道如何使它服务python页面。 all the docs i could find involves having django on top. 我能找到的所有文档都涉及将django放在首位。

You're mixing up things, so let me clarify. 你混淆了事情,所以让我澄清一下。

Python's standard way of publishing applications via web servers is WSGI --you can think of it as a Python's native CGI. Python通过Web服务器发布应用程序的标准方法是WSGI - 您可以将其视为Python的本机CGI。 uWSGI is a WSGI-compliant server that uses uwsgi protocol to talk to other uWSGI instances or upstream servers. uWSGI是一个符合WSGI的服务器,它使用uwsgi协议与其他uWSGI实例或上游服务器通信。 Usually the upstream server is nginx with HttpUwsgiModule that allows it to communicate using uwsgi protocol--with nginx you have additional layer of protection for your app server, load balancing and serving the static files. 通常上游服务器是带有HttpUwsgiModule的 nginx ,允许它使用uwsgi协议进行通信 - 使用nginx,您可以为应用服务器提供额外的保护层,负载平衡和提供静态文件。 In most scenarios, You Should Be Using Nginx + UWSGI . 在大多数情况下, 您应该使用Nginx + UWSGI To answer your question, uWSGI is installed and run separately from nginx, and they both need to be configured to communicate to each other. 为了回答您的问题,uWSGI与nginx分开安装和运行,它们都需要配置为相互通信。

Pure WSGI is pretty low-level, so you may want to use a WSGI-compliant framework . 纯WSGI非常低级,因此您可能希望使用符合WSGI的框架 I guess the top two are Django and Flask . 我猜前两位是DjangoFlask

For a hello world Flask setup, Serving Flask With Nginx seems to be a good article. 对于一个hello world Flask设置, Serving Flask With Nginx似乎是一篇很好的文章。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM