Your SlideShare is downloading. ×
Nginx & php fpm - the webserver you might actually like - php usergroup berlin
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Nginx & php fpm - the webserver you might actually like - php usergroup berlin

15,216
views

Published on

Slides from the talk given at the Berlin PHP Usergroup 2012.11.06

Slides from the talk given at the Berlin PHP Usergroup 2012.11.06

Published in: Technology

0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
15,216
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
24
Comments
0
Likes
6
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. NGINXTHE WEB SERVER YOU MIGHT ACTUALLY LIKE
  • 2. ABOUT MESoftware EngineerPHP since 10 yearsCICleanCodeDevOpsTDDShippingBullet points
  • 3. INSTEAD OF ME
  • 4. WORKING FOR gives science back to the people who make it happen.We help researchers build reputation and accelerate scientific progress. On their terms.
  • 5. LETS GO
  • 6. WHY ANOTHER WEBSERVER?
  • 7. WHY NOT LIGHTTPD?
  • 8. THE BASICSIntroMultiple Servers / DomainsStatic contentCachingSSLError pagesRewritesAuthLoad BalancingProxyPHP!Fancy PHP!
  • 9. INTROsd atgtisalnix uo p-e ntl gn/t/gn/gn.of ecnixnixcn/t/gn/ofd*cn ecnixcn./.of
  • 10. NGINX CONF BASICS/t/gn/gn.of ecnixnixcnue nix sr gn;wre_rcse 4 okrpoess ;wre_p_fiiy00 01 00 10; okrcuafnt 01 00 10 00errlg /a/o/gn/ro.o wr; ro_o vrlgnixerrlg anpd i /a/u/gn.i; vrrnnixpdeet { vns wre_oncin okrcnetos 12; 04}
  • 11. NGINX CONF BASICS/t/gn/gn.of ecnixnixcnht { 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}
  • 12. SERVERS/t/gn/ofdmSt.of ecnixcn./yiecn/t/gn/ie-nbe/alah ecnixstsealdwlbssre { evr sre_aewlbs.o wlbs.e evrnm alahcm alahd; lse 8; itn 0 ro /a/w/yp/tl ot vrwwmAphm/ / .. / .}sre { evr sre_ae_ evrnm ; lse 8; itn 0 ro /a/w/yteAphm/ ot vrwwmOhrp/tl}
  • 13. STATIC CONTENT/t/gn/ofdayofgcn ecnixcn./nCni.ofsre { evr / .. / . lcto /{ oain }}
  • 14. FANCY STATIC CONTENTIsd Sre Bok nie evr lcslcto ~^/j|m|s|onod)/{ oain (sigcsdwlas}lcto ~(scspggfjgpf${ oain .j|s|n|i|p|d)}
  • 15. CACHINGlcto ~^/j|m|s)/{ oain (sigcs eprs1d xie 4;}
  • 16. DENY ACCESS TO ALL .DOT-FILESIsd Sre Bok nie evr lcslcto ~/.{ oain acs_o of ceslg f; lgntfudof o_o_on f; dn al ey l;}
  • 17. SSLsre { evr sre_ae_ evrnm ; lse 43 itn 4; slo; s n} Or justsre { evr lse 43dfutsre sl itn 4 eal_evr s;}
  • 18. SSL - CONFIGslcriiae 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;
  • 19. ERROR PAGESerrpg 5051525354/0.tl ro_ae 0 0 0 0 0 50hm;lcto /0.tl{ oain 50hm itra; nenl} STARTUP BONUS:sre { evr sre_ae*etiTigi; evrnm nxBghn.o lcto /0 { oain 50 rtr 50 eun 0; }}
  • 20. REWRITES HTTPS ALL THE THINGSsre { evr sre_ae _ evrnm ; lse itn 8; 0 rwie^hts/$otrqetuipraet ert tp:/hs$eus_r emnn;} OLDSCHOOLrwie ^ues(+$ /hwue=1 ert /sr/.) so?sr$? ls; at
  • 21. AUTHlcto /{ oain at_ai "etitd; uhbsc Rsrce" at_ai_srfl /t/gn/ofdmAphpsw; uhbscue_ie ecnixcn./yp.tasd}
  • 22. LOAD BALANCINGusra wbwres{ ptem e_okr sre ww.xml.o; evr w1eapecm sre ww.xml.o; evr w2eapecm sre ww.xml.o; evr w3eapecm}
  • 23. 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}
  • 24. PROXYlcto /{ oain poyps rx_as ht:/oahs:00 tp/lclot88; poysthae rx_e_edr XRa-P $eoead; -elI rmt_dr poycce rx_ah zn; oe /Dfut /eal: poycceky$ceepoyhs$r$sag$rs rx_ah_e shm$rx_otuii_rsag;}
  • 25. PHP!
  • 26. PHP-FPM!?!FastCGI Process Manager
  • 27. PROCESS MANAGEMENT FOR THE MASSES Think: "supervisord"; But without caringsd atgtisalpp-p uo p-e ntl h5fm/t/h5fmppfmcn ecpp/p/h-p.of/ Dntrsattewbevr rsatpp: / o etr h esre, etr h )sd sriepp-p rsat uo evc h5fm etr
  • 28. FPM-CONFIG[yp] mAplse =90 itn 00;itnalwdcins=17001 lse.loe_let 2...ue =pp sr hgop=pp ru hrqettriaetmot=1 eus_emnt_ieu 0rqetsolgtmot=1 eus_lwo_ieusolg=/a/o/h-p/yp-lwlg lwo vrlgppfmmApso.o
  • 29. FPM-CONFIG - PROCESS MANAGEMENTp =dnmc m yaip.a_hlrn=5 mmxcide 0p.tr_evr =5 msatsresp.i_pr_evr =5 mmnsaesresp.a_pr_evr =3 mmxsaesres 5
  • 30. NGINX + PHPlcto /{ oain fscips atg_as 1700.:00 2..1190; fsciidx atg_ne idxpp ne.h; fsciprm atg_aa SRP_IEAE$ouetro/ne.h; CITFLNM dcmn_otidxpp icue nld fsciprm; atg_aas}
  • 31. APPLICATION SERVERS!lcto /{ oain fscips atg_as aoteSre:00 nnhrevr90; fsciidx atg_ne idxpp ne.h; fsciprm atg_aa SRP_IEAE$ouetro/ne.h; CITFLNM dcmn_otidxpp icue nld fsciprm; atg_aas}
  • 32. SCALING!lcto /{ oain fscips atg_as wres okr; fsciidx atg_ne idxpp ne.h; fsciprm atg_aa SRP_IEAE$ouetro/ne.h; CITFLNM dcmn_otidxpp icue nld fsciprm; atg_aas}usra wres{ ptem okr sre evr Ap:00 p190; sre evr Ap:00 p290; sre evr 12181.:00 9.6.0390;}
  • 33. THANKS HELGI!@hFurther reading:
  • 34. THANK YOU