Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Nginx The webserver you might actually like

1,827 views

Published on

  • Be the first to comment

  • Be the first to like this

Nginx The webserver you might actually like

  1. 1. NGINXTHE WEB SERVER YOU MIGHT ACTUALLY LIKE
  2. 2. ABOUT MEPHP since 10 yearsCICleanCodeDevOpsTDDShipping
  3. 3. GET IN TOUCHstackoverflow:Twitter: @__edorianXing / G+: Volker DuschIRC: edorianMail: php@wallbash.com
  4. 4. LETS GO
  5. 5. WHY ANOTHER WEBSERVER?
  6. 6. WHY NOT LIGHTTPD?
  7. 7. THE BASICSIntroMultiple Servers / DomainsStatic contentSSLError pagesRewritesAuthCachingLoad BalancingProxyPHP!
  8. 8. INTRO/t/gn/gn.of ecnixnixcn/t/gn/ofd*cn ecnixcn./.of
  9. 9. NGINX CONF BASICSue nix sr gn;wre_rcse 6 okrpoess ;wre_p_fiiy000 001 000 010 000 100; okrcuafnt 001 000 010 000 100 000errlg /a/o/gn/ro.o wr; ro_o vrlgnixerrlg anpd i /a/u/gn.i; vrrnnixpdeet { vns wre_oncin okrcnetos 12; 04}
  10. 10. NGINX CONF BASICSht { tp icue nld /t/gn/ietps ecnixmm.ye; dfuttp apiainottsra; eal_ye plcto/ce-tem acs_o /a/o/gn/ceslg mi; ceslg vrlgnixacs.o an snfl edie o; n keaietmot 6; eplv_ieu 5 icue/t/gn/ofd*cn; nld ecnixcn./.of}
  11. 11. SERVERSsre { evr sre_ae*wlbs.o *wlbs.e evrnm .alahcm .alahd; lse 8; itn 0 / .. / .}sre { evr sre_ae_ evrnm ; lse 8; itn 0 / .. / .}
  12. 12. STATIC CONTENTlcto /{ oain ro /a/w/yp/tl ot vrwwmAphm/}
  13. 13. FANCY STATIC CONTENTlcto ~^/j|m|s){ oain (sigcs}
  14. 14. DENY ACCESS TO ALL .DOT-FILESlcto ~/.{ oain acs_o of ceslg f; lgntfudof o_o_on f; dn al ey l;}
  15. 15. SSLslcriiae s_etfct wlcr.r; idadctslcriiaeky s_etfct_e wlcr.e; idadkyslssintmot 5; s_eso_ieu mslssinccesae:S:0; s_eso_ah hrdSL1mslpooosSL3TS1TS11TS12 s_rtcl Sv Lv Lv. Lv.;slpee_evrcpeso; s_rfrsre_ihr nslcpesEDERAAS5-H34AS5-H26R4HG:M5!NL:EH!E s_ihr CH-S-E26SA8:E26SA5:C:IH!D:aUL!D:ASC; GMsled_uv sc511 s_chcre ep2r;
  16. 16. ERROR PAGESerrpg 5051525354/0.tl ro_ae 0 0 0 0 0 50hm;lcto /0.tl{ oain 50hm itra; nenl}lcto /0 { oain 50 rtr 50 eun 0;}
  17. 17. REWRITESsre { evr sre_ae ht:/; evrnm tp/* lse itn 8; 0 rwie^hts/$otrqetuipraet ert tp:/hs$eus_r emnn;}
  18. 18. CACHINGlcto ~^/j|m|s){ oain (sigcs eprs1d xie 4;}
  19. 19. AUTHlcto /{ oain at_ai "etitd; uhbsc Rsrce" at_ai_srfl /t/gn/ofdmAphpsw; uhbscue_ie ecnixcn./yp.tasd}
  20. 20. LOAD BALANCINGusra wbwres{ ptem e_okr sre ww.xml.o; evr w1eapecm sre ww.xml.o; evr w2eapecm sre ww.xml.o; evr w3eapecm sre ww.xml.o; evr w4eapecm}
  21. 21. LOAD BALANCING LEGACYusra wbwres{ ptem e_okr i_ah phs; sre ww.xml.o; evr w1eapecm sre ww.xml.o; evr w2eapecm sre ww.xml.o; evr w3eapecm sre ww.xml.o; evr w4eapecm}
  22. 22. PROXYlcto /{ oain poyps rx_as ht:/oahs:00 tp/lclot80; poysthae rx_e_edr XRa-P $eoead; -elI rmt_dr poycce rx_ah zn; oe}
  23. 23. PHP!
  24. 24. PHP-FPM!?!FastCGI Process Manager
  25. 25. FPM-CONFIG[yp] mAplse =90 itn 00;itnalwdcins=17001 lse.loe_let 2...ue =pp sr hgop=pp ru hp =dnmc m yaip.a_hlrn=5 mmxcide 0p.tr_evr =5 msatsresp.i_pr_evr =5 mmnsaesresp.a_pr_evr =3 mmxsaesres 5solg=/a/o/h-p/yp-lwlg lwo vrlgppfmmApso.o
  26. 26. NGINX + PHPlcto /{ oain fscips atg_as 1700.:00 2..1190; fsciprm SRP_IEAE /a/w/yp/tlidxpp atg_aa CITFLNM vrwwmAphm/ne.h; icue nld fsciprm; atg_aas}
  27. 27. SCALING!lcto /{ oain fscips atg_as aoteSre:00 nnhrevr90; fsciprm SRP_IEAE /a/w/yp/tlidxpp atg_aa CITFLNM vrwwmAphm/ne.h; icue nld fsciprm; atg_aas}
  28. 28. THANKS HELGI!@hhttp://helgi.ws/Further reading:https://speakerdeck.com/u/helgi/p/cranking-nginx-to-11-phptek-2012
  29. 29. THANK YOU

×