就是简单记录下,之前面试问到这个了,我补上这个
首先两种都是实现WSGI协议的Web服务器,并且都是基于Perfork模型。
其次Uwsgi是通过C语言编写的,
Gnnicorn是通过Python语言编写的,
相对于Uwsgi,Gunicorn相对于简单,启动也十分方便
英文全称:Web Server Gateway Interface,Web服务网管接口,简单来说它是一种Web服务器和应用程序间的通信规范
uWSGI是一个Web Server,并且独占uwsgi协议,但是同时支持WSGI协议、HTTP协议等,它的功能是把HTTP协议转化成语言支持的网络协议供python使用。
gunicorn是一个python Wsgi http server,只支持在Unix系统上运行,来源于Ruby的unicorn项目。Gunicorn使用prefork master-worker模型(在gunicorn中,master被称为arbiter),能够与各种wsgi web框架协作。
先写这么多,有更新再更新
# uwsgi
server {
listen 80;
server_name _;
location / {
include uwsgi_params;
}
}
server {
listen 80;
server_name example.org;
location / {
proxy_pass http://127.0.0.1:8000; #转发gunicorn运行地址
}
}