1. 程式人生 > >Nginx學習筆記01Nginx簡要介紹與目錄說明

Nginx學習筆記01Nginx簡要介紹與目錄說明

server 簡單 adt 服務器 網站目錄 interface simple 內核 優化

1.1. Nginx簡要介紹

(1)NginxWeb服務器。

ApacheIIS:經典的通用Web服務器。

LighttpdNginx:輕量級Web服務器。

TomcatJetty:面向JavaWeb服務器。

(2)Nginx的優點。

Nginx最吸引人的優點在於以下三個方面:

(a)支持高並發。

單機10萬並發。

(b)低內存消耗。10000個非活躍連接僅消耗2.5MB內存。

(c)熱部署。24x7不間斷服務。

(3)Nginx的架構特點。

(a)多進程架構:1Master進程+Nworker進程。

(b)OS內核支持:基於Linux內核支持的epoll通信模型。

(c)高度可擴展:模塊化設計,

HTTP模塊、HTTP過濾器模塊等。官方模塊和第三方模塊。

1.2. Nginx目錄

Nginx常用目錄結構如下圖所示:

目錄

描述

client_body_temp

文件上傳臨時目錄

conf

配置文件目錄,最重要的文件nginx.conf

fastcgi_temp

FastCGI臨時目錄

html

網站目錄

logs

日誌目錄

proxy_temp

代理服務緩存的臨時目錄

sbin

程序目錄,有nginx程序

scgi_temp

SCGI臨時目錄

uwsgi_temp

UWSGI臨時目錄

conf目錄主要內容如下圖所示:

技術分享

1.3. 名詞解釋

CGICommon Gateway Interface,通用網關接口。

FastCGIFast Common Gateway Interface,快速通用網關接口。CGI的改進版,借助於CGI進程管理器來優化CGI程序和Web服務器之間的交互成本。

https://en.wikipedia.org/wiki/FastCGI

SCGISimple Common Gateway Interface,簡單通用網關接口。類似於FastCGI,實現更簡單。

https://en.wikipedia.org/wiki/Simple_Common_Gateway_Interface

WSGIWeb Server Gateway InterfaceWeb服務器網關接口。

https://en.wikipedia.org/wiki/Web_Server_Gateway_Interface

UWSGI

UWSGI做為一個協議,參考:

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

UWSGI作為一個應用服務器,參考:

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

Nginx學習筆記01Nginx簡要介紹與目錄說明