Posted 绋嬪簭鍛橀潰璇曞惂

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了相关的知识,希望对你有一定的参考价值。


鐐瑰嚮鈥?/span>绋嬪簭鍛橀潰璇曞惂鈥濓紝閫夋嫨鈥滄槦鏍囸煍濃€?/span>

鍥炲鍏抽敭璇嶁€滈潰璇曗€濇湁鎯婂枩~


nginx鑱斿悎鍒涘浜哄畨寰烽瞾路闃垮垪鍏嬭阿澶紙Andrew Alexeev锛夋浘璇达細Nginx鏄负瀵笰pache鎬ц兘涓嶆弧鎰忕殑浜鸿€屾瀯寤虹殑銆?/span>闅忕潃Internet闇€姹傜殑鍙樺寲锛學eb鏈嶅姟鍣ㄧ殑宸ヤ綔涔熷湪鍙樺寲銆?/span>Nginx鐨勬瀯寤烘瘮浠ュ線浠讳綍鏃跺€欓兘鏇存湁鏁堢巼锛屾洿鍙墿灞曪紝鏇村畨鍏紝鏇村己澶с€?/span>


鏈枃鎻愪緵浜哊ginx鐨勫熀鏈蹇靛強鐭ヨ瘑銆備互寮€鍙戣€呭繀澶囩殑Nginx鍩虹鐭ヨ瘑涓轰富锛岀綏鍒椾簡涓€浜汵ginx鏁欑▼锛屽笇鏈涘澶у鏈夋墍甯姪銆?/span> 鍏嶈垂Nginx瀛︿範璧勬枡瑙佹枃鏈紒

Nginx璇﹁В锛岀潯鍓嶅崄鍒嗛挓鍟冨畬鍊间簡锛?> 
      </section> 
      <section data-mid=

Nginx鐨勪骇鐢?/p>


Nginx 鍚?Apache 涓€鏍烽兘鏄竴绉?Web 鏈嶅姟鍣ㄣ€傚熀浜?REST 鏋舵瀯椋庢牸锛屼互缁熶竴璧勬簮鎻忚堪绗︼紙Uniform Resources Identifier锛塙RI 鎴栬€呯粺涓€璧勬簮瀹氫綅绗︼紙Uniform Resources Locator锛塙RL 浣滀负娌熼€氫緷鎹紝閫氳繃 HTTP 鍗忚鎻愪緵鍚勭缃戠粶鏈嶅姟銆?/span>


鐒惰€岋紝杩欎簺鏈嶅姟鍣ㄥ湪璁捐涔嬪垵鍙楀埌褰撴椂鐜鐨勫眬闄愶紝渚嬪褰撴椂鐨勭敤鎴疯妯★紝缃戠粶甯﹀锛屼骇鍝佺壒鐐圭瓑灞€闄愬苟涓斿悇鑷殑瀹氫綅鍜屽彂灞曢兘涓嶅敖鐩稿悓銆傝繖涔熶娇寰楀悇涓?Web 鏈嶅姟鍣ㄦ湁鐫€鍚勮嚜椴滄槑鐨勭壒鐐广€?/span>


Apache 鐨勫彂灞曟椂鏈熷緢闀匡紝鑰屼笖鏄鏃犱簤璁殑涓栫晫绗竴澶ф湇鍔″櫒銆傚畠鏈夌潃寰堝浼樼偣锛氱ǔ瀹氥€佸紑婧愩€佽法骞冲彴绛夌瓑銆?/span>


瀹冨嚭鐜扮殑鏃堕棿澶暱浜嗭紝瀹冨叴璧风殑骞翠唬锛屼簰鑱旂綉浜т笟杩滆繙姣斾笉涓婄幇鍦ㄣ€傛墍浠ュ畠琚璁′负涓€涓噸閲忕骇鐨勩€?/span>


瀹冧笉鏀寔楂樺苟鍙戠殑鏈嶅姟鍣ㄣ€傚湪 Apache 涓婅繍琛屾暟浠ヤ竾璁$殑骞跺彂璁块棶锛屼細瀵艰嚧鏈嶅姟鍣ㄦ秷鑰楀ぇ閲忓唴瀛樸€?/span>


鎿嶄綔绯荤粺瀵瑰叾杩涜杩涚▼鎴栫嚎绋嬮棿鐨勫垏鎹篃娑堣€椾簡澶ч噺鐨?CPU 璧勬簮锛屽鑷?HTTP 璇锋眰鐨勫钩鍧囧搷搴旈€熷害闄嶄綆銆?/span>


杩欎簺閮藉喅瀹氫簡 Apache 涓嶅彲鑳芥垚涓洪珮鎬ц兘 Web 鏈嶅姟鍣紝杞婚噺绾ч珮骞跺彂鏈嶅姟鍣?Nginx 灏卞簲杩愯€岀敓浜嗐€?/span>


淇勭綏鏂殑宸ョ▼甯?Igor Sysoev锛屼粬鍦ㄤ负 Rambler Media 宸ヤ綔鏈熼棿锛屼娇鐢?C 璇█寮€鍙戜簡 Nginx銆?/span>


Nginx 浣滀负 Web 鏈嶅姟鍣ㄤ竴鐩翠负 Rambler Media 鎻愪緵鍑鸿壊鑰屽張绋冲畾鐨勬湇鍔°€傜劧鍚庡憿锛孖gor Sysoev 灏?Nginx 浠g爜寮€婧愶紝骞朵笖璧嬩簣鑷敱杞欢璁稿彲璇併€?/span>


鐢变簬浠ヤ笅杩欏嚑鐐癸紝鎵€浠ワ紝Nginx 鐏簡锛?/span>


  • Nginx 浣跨敤鍩轰簬浜嬩欢椹卞姩鏋舵瀯锛屼娇寰楀叾鍙互鏀寔鏁颁互鐧句竾绾у埆鐨?TCP 杩炴帴銆?/span>

  • 楂樺害鐨勬ā鍧楀寲鍜岃嚜鐢辫蒋浠惰鍙瘉浣垮緱绗笁鏂规ā鍧楀眰鍑轰笉绌凤紙杩欐槸涓紑婧愮殑鏃朵唬鍟婏級銆?/span>

  • Nginx 鏄竴涓法骞冲彴鏈嶅姟鍣紝鍙互杩愯鍦?Linux銆乄indows銆丗reeBSD銆丼olaris銆丄IX銆丮ac OS 绛夋搷浣滅郴缁熶笂銆?/span>

  • 杩欎簺浼樼鐨勮璁″甫鏉ョ殑鏋佸ぇ鐨勭ǔ瀹氭€с€?/span>



Nginx璇﹁В锛岀潯鍓嶅崄鍒嗛挓鍟冨畬鍊间簡锛?> 
      </section> 
      <section data-mid=

Nginx 鍩烘湰姒傚康



0 1

姝e悜浠g悊涓庡弽鍚戜唬鐞?/span>





涓轰簡渚夸簬鐞嗚В锛岄鍏堝厛鏉ヤ簡瑙d竴涓嬩竴浜涘熀纭€鐭ヨ瘑锛宯ginx鏄竴涓珮鎬ц兘鐨勫弽鍚戜唬鐞嗘湇鍔″櫒閭d箞浠€涔堟槸鍙嶅悜浠g悊鍛紵


浠g悊鏄湪鏈嶅姟鍣ㄥ拰瀹㈡埛绔箣闂村亣璁剧殑涓€灞傛湇鍔″櫒锛屼唬鐞嗗皢鎺ユ敹瀹㈡埛绔殑璇锋眰骞跺皢瀹冭浆鍙戠粰鏈嶅姟鍣紝鐒跺悗灏嗘湇鍔$鐨勫搷搴旇浆鍙戠粰瀹㈡埛绔€?/span>


涓嶇鏄鍚戜唬鐞嗚繕鏄弽鍚戜唬鐞嗭紝瀹炵幇鐨勯兘鏄笂闈㈢殑鍔熻兘銆?/span>

濡傛灉浣犲OSI 涓冨眰妯″瀷涓?TCP/IP 鍥涘眰妯″瀷涓嶆槸寰堢啛鎮夊彲浠ュ啀鍥為【涓?/span>

Nginx璇﹁В锛岀潯鍓嶅崄鍒嗛挓鍟冨畬鍊间簡锛?></span></p> 
   <blockquote class= 姝e悜浠g悊

姝e悜浠g悊锛坒orward锛夋剰鎬濇槸涓€涓綅浜庡鎴风鍜屽師濮嬫湇鍔″櫒 (origin server) 涔嬮棿鐨勬湇鍔″櫒锛屼负浜嗕粠鍘熷鏈嶅姟鍣ㄥ彇寰楀唴瀹癸紝瀹㈡埛绔悜浠g悊鍙戦€佷竴涓姹傚苟鎸囧畾鐩爣 (鍘熷鏈嶅姟鍣?锛岀劧鍚庝唬鐞嗗悜鍘熷鏈嶅姟鍣ㄨ浆浜よ姹傚苟灏嗚幏寰楃殑鍐呭杩斿洖缁欏鎴风銆?/span>


姝e悜浠g悊鏄负鎴戜滑鏈嶅姟鐨勶紝鍗充负瀹㈡埛绔湇鍔$殑锛屽鎴风鍙互鏍规嵁姝e悜浠g悊璁块棶鍒板畠鏈韩鏃犳硶璁块棶鍒扮殑鏈嶅姟鍣ㄨ祫婧愩€?/span>


姝e悜浠g悊瀵规垜浠槸閫忔槑鐨勶紝瀵规湇鍔$鏄潪閫忔槑鐨勶紝鍗虫湇鍔$骞朵笉鐭ラ亾鑷繁鏀跺埌鐨勬槸鏉ヨ嚜浠g悊鐨勮闂繕鏄潵鑷湡瀹炲鎴风鐨勮闂€?/span>


鍙嶅悜浠g悊

鍙嶅悜浠g悊锛圧everse Proxy锛夋柟寮忔槸鎸囦互浠g悊鏈嶅姟鍣ㄦ潵鎺ュ彈 internet 涓婄殑杩炴帴璇锋眰锛岀劧鍚庡皢璇锋眰杞彂缁欏唴閮ㄧ綉缁滀笂鐨勬湇鍔″櫒锛屽苟灏嗕粠鏈嶅姟鍣ㄤ笂寰楀埌鐨勭粨鏋滆繑鍥炵粰 internet 涓婅姹傝繛鎺ョ殑瀹㈡埛绔紝姝ゆ椂浠g悊鏈嶅姟鍣ㄥ澶栧氨琛ㄧ幇涓轰竴涓弽鍚戜唬鐞嗘湇鍔″櫒銆?/span>


鍙嶅悜浠g悊鏄负鏈嶅姟绔湇鍔$殑锛屽弽鍚戜唬鐞嗗彲浠ュ府鍔╂湇鍔″櫒鎺ユ敹鏉ヨ嚜瀹㈡埛绔殑璇锋眰锛屽府鍔╂湇鍔″櫒鍋氳姹傝浆鍙戯紝璐熻浇鍧囪 绛夈€?/span>


鍙嶅悜浠g悊瀵规湇鍔$鏄€忔槑鐨勶紝瀵规垜浠槸闈為€忔槑鐨勶紝鍗虫垜浠苟涓嶇煡閬撹嚜宸辫闂殑鏄唬鐞嗘湇鍔″櫒锛岃€屾湇鍔″櫒鐭ラ亾鍙嶅悜浠g悊鍦ㄤ负浠栨湇鍔°€?/span>



0 2

璐熻浇鍧囪 





濡傛灉璇锋眰鏁拌繃澶э紝鍗曚釜鏈嶅姟鍣ㄨВ鍐充笉浜嗭紝鎴戜滑澧炲姞鏈嶅姟鍣ㄧ殑鏁伴噺锛岀劧鍚庡皢璇锋眰鍒嗗彂鍒板悇涓湇鍔″櫒涓婏紝灏嗗師鍏堣姹傞泦涓埌鍗曚釜鏈嶅姟鍣ㄧ殑鎯呭喌鏀逛负璇锋眰鍒嗗彂鍒板涓湇鍔″櫒涓婏紝灏辨槸璐熻浇鍧囪 銆?/span>


upstream balanceServer { server 10.1.22.33:12345; server 10.1.22.34:12345;
server 10.1.22.35:12345;}
server { server_name fe.server.com; listen 80; location /api { proxy_pass http://balanceServer; }}


涓婇潰鐨勯厤缃彧鏄寚瀹氫簡 nginx 闇€瑕佽浆鍙戠殑鏈嶅姟绔垪琛紝骞舵病鏈夋寚瀹氬垎閰嶇瓥鐣ャ€?/span>


榛樿鎯呭喌涓嬮噰鐢ㄧ殑鏄疆璇㈢瓥鐣ワ紝灏嗘墍鏈夊鎴风璇锋眰杞鍒嗛厤缁欐湇鍔$銆傝繖绉嶇瓥鐣ユ槸鍙互姝e父宸ヤ綔鐨勶紝浣嗘槸濡傛灉鍏朵腑鏌愪竴鍙版湇鍔″櫒鍘嬪姏澶ぇ锛屽嚭鐜板欢杩燂紝浼氬奖鍝嶆墍鏈夊垎閰嶅湪杩欏彴鏈嶅姟鍣ㄤ笅鐨勭敤鎴枫€?/span>


Nginx鏀寔鐨勮礋杞藉潎琛¤皟搴︾畻娉曟柟寮忓涓嬶細



fair锛?/span>鏅鸿兘璋冩暣璋冨害绠楁硶锛屽姩鎬佺殑鏍规嵁鍚庣鏈嶅姟鍣ㄧ殑璇锋眰澶勭悊鍒板搷搴旂殑鏃堕棿杩涜鍧囪 鍒嗛厤锛屽搷搴旀椂闂寸煭澶勭悊鏁堢巼楂樼殑鏈嶅姟鍣ㄥ垎閰嶅埌璇锋眰鐨勬鐜囬珮锛屽搷搴旀椂闂撮暱澶勭悊鏁堢巼浣庣殑鏈嶅姟鍣ㄥ垎閰嶅埌鐨勮姹傚皯锛涚粨鍚堜簡鍓嶄袱鑰呯殑浼樼偣鐨勪竴绉嶈皟搴︾畻娉曘€備絾鏄渶瑕佹敞鎰忕殑鏄疦ginx榛樿涓嶆敮鎸乫air绠楁硶锛屽鏋滆浣跨敤杩欑璋冨害绠楁硶锛岃瀹夎upstream_fair妯″潡銆倁rl_hash锛氭寜鐓ц闂殑url鐨刪ash缁撴灉鍒嗛厤璇锋眰锛屾瘡涓姹傜殑url浼氭寚鍚戝悗绔浐瀹氱殑鏌愪釜鏈嶅姟鍣紝鍙互鍦∟ginx浣滀负闈欐€佹湇鍔″櫒鐨勬儏鍐典笅鎻愰珮缂撳瓨鏁堢巼銆傚悓鏍疯娉ㄦ剰Nginx榛樿涓嶆敮鎸佽繖绉嶈皟搴︾畻娉曪紝瑕佷娇鐢ㄧ殑璇濋渶瑕佸畨瑁匩ginx鐨刪ash杞欢鍖呫€?/span>


03

鍔ㄩ潤鍒嗙




涓轰簡鍔犲揩鏈嶅姟鍣ㄧ殑瑙f瀽閫熷害锛屽彲浠ユ妸鍔ㄦ€侀〉闈㈠拰闈欐€侀〉闈氦缁欎笉鍚岀殑鏈嶅姟鍣ㄦ潵瑙f瀽锛屽姞蹇В鏋愰€熷害锛岄檷浣庡師鏉ュ崟涓湇鍔″櫒鐨勫帇鍔涖€?/span>


0 4

Nginx甯哥敤鍛戒护





# 蹇€熷叧闂璑ginx锛屽彲鑳戒笉淇濆瓨鐩稿叧淇℃伅锛屽苟杩呴€熺粓姝eb鏈嶅姟nginx -s stop# 骞崇ǔ鍏抽棴Nginx锛屼繚瀛樼浉鍏充俊鎭紝鏈夊畨鎺掔殑缁撴潫web鏈嶅姟nginx -s quit# 鍥犳敼鍙樹簡Nginx鐩稿叧閰嶇疆锛岄渶瑕侀噸鏂板姞杞介厤缃€岄噸杞?/span>nginx -s reload# 閲嶆柊鎵撳紑鏃ュ織鏂囦欢nginx -s reopen# 涓?Nginx 鎸囧畾涓€涓厤缃枃浠讹紝鏉ヤ唬鏇跨己鐪佺殑nginx -c filename# 涓嶈繍琛岋紝鑰屼粎浠呮祴璇曢厤缃枃浠躲€俷ginx 灏嗘鏌ラ厤缃枃浠剁殑璇硶鐨勬纭€э紝骞跺皾璇曟墦寮€閰嶇疆鏂囦欢涓墍寮曠敤鍒扮殑鏂囦欢nginx -t# 鏄剧ず nginx 鐨勭増鏈?/span>nginx -v# 鏄剧ず nginx 鐨勭増鏈紝缂栬瘧鍣ㄧ増鏈拰閰嶇疆鍙傛暟nginx -V# 鏍煎紡鎹㈡樉绀?nginx 閰嶇疆鍙傛暟2>&1 nginx -V | xargs -n12>&1 nginx -V | xargs -n1 | grep lua


Nginx璇﹁В锛岀潯鍓嶅崄鍒嗛挓鍟冨畬鍊间簡锛?> 
      </section> 
      <section data-mid=

涓轰粈涔堥€夋嫨Nginx


Nginx鏄竴娆捐嚜鐢辩殑銆佸紑婧愮殑銆侀珮鎬ц兘鐨凥TTP鏈嶅姟鍣ㄥ拰鍙嶅悜浠g悊鏈嶅姟鍣紱鍚屾椂涔熸槸涓€涓狪MAP銆丳OP3銆丼MTP浠g悊鏈嶅姟鍣紱Nginx鍙互浣滀负涓€涓狧TTP鏈嶅姟鍣ㄨ繘琛岀綉绔欑殑鍙戝竷澶勭悊锛屽彟澶朜ginx鍙互浣滀负鍙嶅悜浠g悊杩涜璐熻浇鍧囪 鐨勫疄鐜般€傚湪Nginx缃戠珯涓婏紝鍏跺姛鑳藉寘鎷細


  • HTTP鍜孒TTPS锛圱LS / SSL / SNI锛?/span>

  • 瓒呭揩閫熺殑Web鏈嶅姟鍣ㄧ敤浜庨潤鎬佸唴瀹?/span>

  • FastCGI锛學SGI锛孲CGI鐢ㄤ簬鍔ㄦ€佸唴瀹?/span>

  • 鍏锋湁璐熻浇骞宠 鍜岀紦瀛樺姛鑳界殑鍔犻€焀eb浠g悊

  • 涓嶉棿鏂疄鏃朵簩杩涘埗鍗囩骇鍜岄厤缃?/span>

  • 鍘嬬缉鍜屽唴瀹硅繃婊ゅ櫒

  • 铏氭嫙涓绘満

  • FLV鍜孧P4鐨勫獟浣撴祦

  • 甯﹀鍜岃繛鎺ョ瓥鐣?/span>

  • 鍏ㄩ潰鐨勮闂帶鍒?/span>

  • 鑷畾涔夋棩蹇?/span>

  • 宓屽叆寮忚剼鏈?/span>

  • 甯︽湁TLS鐨凷MTP / IMAP / POP3鐨勯偖浠朵唬鐞?/span>

  • 閫昏緫锛岀伒娲伙紝鍙墿灞曠殑閰嶇疆

  • 鍦↙inux锛孎reeBSD锛孧ac OS X锛孲olaris鍜學indows涓婅繍琛?/span>

Nginx鏈夊涓嬩紭鍔匡細


0 1

IO澶氳矾澶嶇敤epoll锛圛O澶嶇敤锛?/span>




濡備綍鐞嗚В鍛紵涓句釜渚嬪瓙鍚э紒


鏈堿銆丅銆丆涓変釜鑰佸笀锛屼粬浠兘閬囧埌涓€涓毦棰橈紝瑕佸府鍔╀竴涓彮绾х殑瀛︾敓瑙e喅璇惧爞浣滀笟銆?br class="mq-257">鑰佸笀A閲囩敤浠庣涓€鎺掑紑濮嬩竴涓鐢熶竴涓鐢熻疆娴佽В绛旂殑鏂瑰紡鍘诲洖绛旈棶棰橈紝鑰佸笀A娴垂浜嗗緢澶氭椂闂达紝骞朵笖鏈夌殑瀛︾敓浣滀笟杩樻病鏈夊畬鎴愬憿锛岃€佸笀灏辨潵浜嗭紝鍙嶅弽澶嶅鏁堢巼鏋佹參銆?br class="mq-258">鑰佸笀B鏄竴涓繊鑰咃紝浠栧彂鐜拌€佸笀A鐨勬柟娉曡涓嶉€氾紝浜庢槸浠栦娇鐢ㄤ簡褰卞垎韬湳锛屽垎韬嚭濂藉嚑涓嚜宸卞悓涓€鏃堕棿鍘诲府濂藉嚑涓悓瀛﹀洖绛旈棶棰橈紝鏈€鍚庤繕娌″洖绛斿畬锛岃€佸笀B娑堣€楀厜浜嗚兘閲忕疮鍊掍簡銆?/span>


鑰佸笀C姣旇緝绮炬槑锛屼粬鍛婅瘔瀛︾敓锛岃皝瀹屾垚浜嗕綔涓氫妇鎵嬶紝鏈変妇鎵嬬殑鍚屽浠栨墠鍘绘寚瀵奸棶棰橈紝浠栬瀛︾敓涓诲姩鍙戝0锛屽垎寮€浜嗏€滃苟鍙戔€濄€?/span>


杩欎釜鑰佸笀C灏辨槸Nginx銆?/span>



02

杞婚噺绾?/span>





  • 鍔熻兘妯″潡灏?- Nginx浠呬繚鐣欎簡HTTP闇€瑕佺殑妯″潡锛屽叾浠栭兘鐢ㄦ彃浠剁殑鏂瑰紡锛屽悗澶╂坊鍔?/span>

  • 浠g爜妯″潡鍖?- 鏇撮€傚悎浜屾寮€鍙戯紝濡傞樋閲屽反宸碩engine




0 3

CPU浜插拰




鎶奀PU鏍稿績鍜孨ginx宸ヤ綔杩涚▼缁戝畾锛屾妸姣忎釜worker杩涚▼鍥哄畾鍦ㄤ竴涓狢PU涓婃墽琛岋紝鍑忓皯鍒囨崲CPU鐨刢ache miss锛屼粠鑰屾彁楂樻€ц兘銆?/span>



Nginx璇﹁В锛岀潯鍓嶅崄鍒嗛挓鍟冨畬鍊间簡锛?> 
      </section> 
      <section data-mid=

 Nginx閰嶇疆


#鎵撳紑涓婚厤缃枃浠讹紝鑻ヤ綘鏄敤lnmp鐜瀹夎vim /usr/local/nginx/conf/nginx.conf
----------------------------------------
user #璁剧疆nginx鏈嶅姟鐨勭郴缁熶娇鐢ㄧ敤鎴?/span>worker_processes #宸ヤ綔杩涚▼鏁?涓€鑸儏鍐典笌CPU鏍告暟淇濇寔涓€鑷?/span>error_log #nginx鐨勯敊璇棩蹇?/span>pid #nginx鍚姩鏃剁殑pid
events { worker_connections #姣忎釜杩涚▼鍏佽鏈€澶ц繛鎺ユ暟 use #nginx浣跨敤鐨勫唴鏍告ā鍨?/span>}

鎴戜滑浣跨敤 nginx 鐨?http 鏈嶅姟锛屽湪閰嶇疆鏂囦欢 nginx.conf 涓殑 http 鍖哄煙鍐咃紝閰嶇疆鏃犳暟涓?server 锛屾瘡涓€涓?server 瀵瑰簲杩欎竴涓櫄鎷熶富鏈烘垨鑰呭煙鍚嶃€?/span>

http { ... ... #鍚庨潰鍐嶈缁嗕粙缁?http 閰嶇疆椤圭洰  server { listen 80 #鐩戝惉绔彛; server_name localhost #鍦板潃  location / { #璁块棶棣栭〉璺緞 root /xxx/xxx/index.html #榛樿鐩綍 index index.html index.htm #榛樿鏂囦欢 }   error_page 500 504 /50x.html #褰撳嚭鐜颁互涓婄姸鎬佺爜鏃朵粠鏂板畾涔夊埌50x.html location = /50x.html { #褰撹闂?0x.html鏃?/span> root /xxx/xxx/html #50x.html 椤甸潰鎵€鍦ㄤ綅缃?/span> }  }  server { ... ...  } }

涓€涓?server 鍙互鍑虹幇澶氫釜 location 锛屾垜浠涓嶅悓鐨勮闂矾寰勮繘琛屼笉鍚屾儏鍐电殑閰嶇疆銆?/span>


鎴戜滑鍐嶆潵鐪嬬湅 http 鐨勯厤缃鎯?/span>

http { sendfile on #楂樻晥浼犺緭鏂囦欢鐨勬ā寮?涓€瀹氳寮€鍚?/span> keepalive_timeout 65 #瀹㈡埛绔湇鍔$璇锋眰瓒呮椂鏃堕棿 log_format main XXX #瀹氫箟鏃ュ織鏍煎紡 浠e彿涓簃ain access_log /usr/local/access.log main #鏃ュ織淇濆瓨鍦板潃 鏍煎紡浠g爜 main}

涓嬮潰鏄?nginx 涓€浜涢厤缃腑甯哥敤鐨勫唴缃叏灞€鍙橀噺锛屼綘鍙互鍦ㄩ厤缃殑浠讳綍浣嶇疆浣跨敤瀹冧滑銆?/span>

Nginx璇﹁В锛岀潯鍓嶅崄鍒嗛挓鍟冨畬鍊间簡锛?></span></p> 
   <p class=

Nginx璇﹁В锛岀潯鍓嶅崄鍒嗛挓鍟冨畬鍊间簡锛?> 
     </section> 
    </section> 
   </section> 
   <p><br mpa-from-tpl=

銆怤ginx鍏嶈垂瀛︿範璧勬枡闄愭椂鍏嶈垂鍙戞斁涓€?/strong>

Nginx璇﹁В锛岀潯鍓嶅崄鍒嗛挓鍟冨畬鍊间簡锛?></p> 
       <p class=鐢靛瓙涔?/span>

Nginx璇﹁В锛岀潯鍓嶅崄鍒嗛挓鍟冨畬鍊间簡锛?></p> 
       <p class=楂樿柂蹇呭瑙嗛


鑾峰彇鏂瑰紡
璇嗗埆鍏虫敞鍏紬鍙峰洖澶?/span> 鈥?/strong> nginx璧勬枡 鈥?/strong> 鍗冲彲棰嗗彇锛?/span>



寰€鏈熸帹鑽?/span>


以上是关于的主要内容,如果未能解决你的问题,请参考以下文章

谷歌浏览器调试jsp 引入代码片段,如何调试代码片段中的js

片段和活动之间的核心区别是啥?哪些代码可以写成片段?

VSCode自定义代码片段——.vue文件的模板

VSCode自定义代码片段6——CSS选择器

VSCode自定义代码片段——声明函数

VSCode自定义代码片段8——声明函数