ç§ãã¡Laterã¯ãéä¿¡äºæ¥è åãã®è«æ±æžäœæã«æºãã£ãŠãããHabréã«è£œåéçºã«ã€ããŠäŒããèå³æ·±ãæè¡ç¿»èš³è³æãå ¬éããŠããŸãã ãããŠæ¬æ¥ã人æ°ã®ããnginx WebãµãŒããŒã®å€èŠ³ãã¢ãŒããã¯ãã£ãããã³çµç¹ã®åææ¡ä»¶ã説æããã ãªãŒãã³ãœãŒã¹ã¢ããªã±ãŒã·ã§ã³ã®ã¢ãŒããã¯ã㣠ããšããæ¬ã®ç« ã®1ã€ã«é©å¿ãã翻蚳ãã玹ä»ããŸãã
ãã«ãã¹ã¬ããå€
çŸåšãã€ã³ã¿ãŒãããã¯ããããå Žæã«æµžéããŠããã10ã15幎åã§ãã£ãŠããã°ããŒãã«ãããã¯ãŒã¯ã®éçºã¯ããã»ã©é²ãã§ããªãã£ããšæ³åããã®ã¯éåžžã«å°é£ã§ãã ã€ã³ã¿ãŒãããã¯ãNCSAããã³Apache WebãµãŒããŒã§å®è¡ãããåçŽãªã¯ãªãã¯å¯èœãªHTML Webãµã€ããããäžçäžã®äœåå人ãã®äººã ã䜿çšããåžžæåäœããéä¿¡ç°å¢ã«é²åããŸããã ãããã¯ãŒã¯ã«åžžææ¥ç¶ãããŠããããã€ã¹ã®æ°ã¯å¢ãç¶ããŠãããã€ã³ã¿ãŒãããã®ç¶æ³ã¯å€åããŠããããªã³ã©ã€ã³ã®çµæžéšéå šäœã®æµãã«è²¢ç®ããŠããŸãã ãªã³ã©ã€ã³ãµãŒãã¹ã¯ããè€éã«ãªã£ãŠããããã®æåã«ã¯ãå¿ èŠãªæ å ±ãå³åº§ã«åä¿¡ããæ©èœãå¿ èŠã§ãã ãªã³ã©ã€ã³ããžãã¹ã®ã»ãã¥ãªãã£é¢ãå€§å¹ ã«å€æŽãããŸããã ãããã£ãŠãçŸåšã®ãµã€ãã¯ä»¥åãããã¯ããã«è€éã«ãªããäžè¬çãªå Žåããã®å®å®æ§ãšã¹ã±ãŒã©ããªãã£ã確ä¿ããããã«ãã¯ããã«å€ãã®ãšã³ãžãã¢ãªã³ã°åªåãå¿ èŠã«ãªããŸãã
ãµã€ãã¢ãŒããã¯ãã«ãšã£ãŠåžžã«å€§ããªèª²é¡ã®1ã€ã¯ããã«ãã¹ã¬ããåã§ãã WebãµãŒãã¹æ代ã®å§ãŸã以æ¥ããã«ãã¹ã¬ããã¯çå®ã«å¢å ããŠããŸãã ä»æ¥ã人æ°ã®ãããµã€ãã¯åæã«æ°åäžäººãããã«ã¯æ°çŸäžäººã®ãŠãŒã¶ãŒã«ãµãŒãã¹ãæäŸã§ããŸããããã¯èª°ãé©ãããšã§ã¯ãããŸããã å°ãåãŸã§ã¯ãé ãADSLæ¥ç¶ãŸãã¯ãã€ã€ã«ã¢ããæ¥ç¶ã§åäœããããã«ãã«ãã¹ã¬ãããå¿ èŠã§ããã çŸåšãã¢ãã€ã«ããã€ã¹ãšãäžå®ã®é«éæ¥ç¶ãå¿ èŠãšããæ°ããã¢ããªã±ãŒã·ã§ã³ã¢ãŒããã¯ãã£ã䜿çšããã«ã¯ããã«ãã¹ã¬ãããå¿ èŠã§ããã¯ã©ã€ã¢ã³ãã¯ããã€ãŒãããã¥ãŒã¹ããœãŒã·ã£ã«ã¡ãã£ã¢ãã£ãŒãããã®æ å ±ãªã©ã®æŽæ°ãåä¿¡ããå¿ èŠããããŸãã ãã«ãã¹ã¬ããã«åœ±é¿ãããã1ã€ã®éèŠãªèŠå ã¯ããã©ãŠã¶ãŒã®åäœã®å€æŽã§ãããã©ãŠã¶ãŒã¯ããµã€ããžã®4ã6ã®åææ¥ç¶ãéããŠãèªã¿èŸŒã¿ãé«éåããŸãã
100 KBã®çãå¿çãçæããåçŽãªApacheãµãŒããŒãã€ãŸãããã¹ããŸãã¯ç»åãå«ãåçŽãªWebããŒãžãæ³åããŠãã ããã ããŒãžã®çæãšã¬ã³ããªã³ã°ã«ã¯æ°ç§ããããŸãããã¯ã©ã€ã¢ã³ãã80 kbit / sã®åž¯åå¹ ã§ããŒãžã転éããã«ã¯10ç§ããããŸãã WebãµãŒããŒã¯100ãããã€ãã®ã³ã³ãã³ããæ¯èŒçè¿ éã«ãåŒãåºããããšãã§ãããã®åŸ10ç§éã¯ã©ã€ã¢ã³ãã«ãã£ãããšè»¢éããŸãã ããã§ãåãã³ã³ãã³ããèŠæ±ãã1000ã®åææ¥ç¶ã¯ã©ã€ã¢ã³ãããããšããŸãã åã¯ã©ã€ã¢ã³ãã1 MBã®è¿œå ã¡ã¢ãªãå¿ èŠãšããå Žåã1000ã¯ã©ã€ã¢ã³ãã«100ãããã€ãã®ã³ã³ãã³ããéä¿¡ããã«ã¯ãåèš1ã®ã¬ãã€ãã®ã¡ã¢ãªãå¿ èŠã«ãªããŸãã
æ°žç¶çãªæ¥ç¶ã®å Žåããã«ãã¹ã¬ããåŠçã®åé¡ã¯ããã«æ·±å»ã«ãªããŸããããã¯ãæ°ããHTTPæ¥ç¶ã®ç¢ºç«ã«é¢é£ããé 延ãåé¿ããããã«ãã¯ã©ã€ã¢ã³ããæ¥ç¶ããããŸãŸã«ãªãããã§ãã
ã€ã³ã¿ãŒãããã®èŠèŽè ã®æ¡å€§ã«äŒŽãè² è·ã®å¢å ãããã³ãã®çµæãšããŠã®ãã«ãã¹ã¬ããã¬ãã«ã®å¢å ã«å¯Ÿå¿ããã«ã¯ããµã€ãã®æ©èœã®åºç€ãéåžžã«å¹æçãªãããã¯ã§æ§æããå¿ èŠããããŸãã ãã®æ¹çšåŒã§ã¯ããã¹ãŠã®ã³ã³ããŒãã³ãïŒããŒããŠã§ã¢ïŒCPUãã¡ã¢ãªããã£ã¹ã¯ïŒããããã¯ãŒã¯å®¹éãã¢ããªã±ãŒã·ã§ã³ã¢ãŒããã¯ãã£ãããã³ããŒã¿ã¹ãã¬ãŒãžïŒãéèŠã§ãããã¯ã©ã€ã¢ã³ãèŠæ±ã¯WebãµãŒããŒã«ãã£ãŠåä¿¡ããã³åŠçãããŸãã ãããã£ãŠã1ç§ãããã«åŠçãããåææ¥ç¶ãšãªã¯ãšã¹ãã®æ°ãå¢å ããã«ã€ããŠãéç·åœ¢ã¹ã±ãŒãªã³ã°ãå¯èœã§ããå¿ èŠããããŸãã
Apacheã®åé¡
Apache WebãµãŒããŒã¯ãŸã ã€ã³ã¿ãŒãããäžã§ç®ç«ã£ãŠããŸãã ãã®ãããžã§ã¯ãã®ã«ãŒãã¯1990幎代åé ã«ããã®ãŒããåœåã¯ãã®ã¢ãŒããã¯ãã£ããæ¢åã®ã·ã¹ãã ãšããŒããŠã§ã¢ãããã³ã€ã³ã¿ãŒãããã®äžè¬çãªéçºåºŠã«ãã£ãŠåŒ·åãããŸããã ãã®å ŽåãWebãµã€ãã¯ååãšããŠãApacheã®åäžã€ã³ã¹ã¿ã³ã¹ãå®è¡ãããŠããå¥åã®ç©çãµãŒããŒã§ããã 2000幎代ã®åããŸã§ã«ãåäžã®ç©çãµãŒããŒãæã€ã¢ãã«ã¯ãæé·ããWebãµãŒãã¹ã®ããŒãºãæºããããã«å¹æçã«è€è£œã§ããªãããšãæããã«ãªããŸããã Apacheã¯ãããªãéçºã«é©ãããã©ãããã©ãŒã ã§ãããšããäºå®ã«ãããããããå ã ã¯æ°ããæ¥ç¶ããšã«WebãµãŒããŒã®ã³ããŒãäœæããããã«èšèšãããŠãããããçŸä»£ã®ç¶æ³ã§ã¯å¿ èŠãªã¹ã±ãŒã©ããªãã£ãéæã§ããŸããã
æçµçã«ãApacheã¯ãµãŒãããŒãã£ãµãŒãã¹ã®åŒ·åãªãšã³ã·ã¹ãã ãéçºããŸãããããã«ãããéçºè ã¯ã¢ããªã±ãŒã·ã§ã³ãäœæããããã®ã»ãŒãã¹ãŠã®ããŒã«ãå ¥æã§ããŸãã ãããããã¹ãŠã«äŸ¡æ Œãããããã®å Žåãåäžã®ãœãããŠã§ã¢è£œåãæäœããããã®å€æ°ã®ããŒã«ã«å¯ŸããŠãããå°ãªãã¹ã±ãŒãªã³ã°æ©èœãæ¯æãå¿ èŠããããŸãã
åææ¥ç¶ãåŠçããããã®åŸæ¥ã®ã¹ã¬ãããŸãã¯ããã»ã¹ããŒã¹ã®ã¢ãã«ã¯ãåæ¥ç¶ãåå¥ã®ããã»ã¹ãŸãã¯ã¹ããªãŒã ã§åŠçããI / Oããããã¯ããããšãæå³ããŸãã ã¢ããªã±ãŒã·ã§ã³ã«ãã£ãŠã¯ããã®ã¢ãããŒãã¯ããã»ããµãšã¡ã¢ãªãªãœãŒã¹ã®ã³ã¹ãã®ç¹ã§éåžžã«å¹çãæªãå ŽåããããŸãã åå¥ã®ããã»ã¹ãŸãã¯ã¹ã¬ãããäœæããã«ã¯ãã¹ã¿ãã¯ã¡ã¢ãªãšããŒãã¡ã¢ãªã®å²ãåœãŠãããã³æ°ããå®è¡ã³ã³ããã¹ãã®äœæãªã©ãæ°ããã¹ã¿ãŒãã¢ããç°å¢ãæºåããå¿ èŠããããŸãã ããã¯ãã¹ãŠäœåãªããã»ããµãŒæéãå¿ èŠãšããæçµçã«é床ã®ã³ã³ããã¹ãåãæ¿ãã«ããããã©ãŒãã³ã¹ã®åé¡ã«ã€ãªããå¯èœæ§ããããŸãã Apacheãªã©ã®å€ãã¢ãŒããã¯ãã£ã®WebãµãŒããŒã䜿çšãããšããããã®åé¡ã¯ãã¹ãŠå®å šã«çŸããŸãã
ãã®è³æã§ã¯ãæã人æ°ã®ãã2ã€ã®WebãµãŒããŒã®äœæ¥ã®å®çšçãªæ¯èŒãHabréã§å ¬éãããŠããŸãã
Nginx WebãµãŒããŒã¢ãŒããã¯ãã£ã®æŠèŠ
nginxã¯ããã®ååšã®æåãããWebãµã€ãã®åçãªæé·ãå¯èœã«ãããšåæã«ããµãŒããŒãªãœãŒã¹ã®ããã©ãŒãã³ã¹ãšçµæžçãªäœ¿çšãéæããããã®å°çšããŒã«ã®åœ¹å²ãæãããªããã°ãªããŸããã§ããã ãã®çµæãnginxã¯éåæã®ã¢ãžã¥ãŒã«åŒã®ã€ãã³ãæåã¢ãŒããã¯ãã£ãåãåããŸããã
Nginxã¯å€éåãšã€ãã³ãéç¥ãç©æ¥µçã«äœ¿çšããç¹å®ã®ã¿ã¹ã¯ãåã ã®ããã»ã¹ã«å²ãåœãŠãŸãã æ¥ç¶ã¯ãã¯ãŒã«ãŒãšåŒã°ããäžå®æ°ã®ã·ã³ã°ã«ã¹ã¬ããããã»ã¹ã䜿çšããå¹ççãªå®è¡ã«ãŒããéããŠåŠçãããŸãã åã¯ãŒã«ãŒå ã§ãnginxã¯1ç§ãããäœåãã®åææ¥ç¶ãšãªã¯ãšã¹ããåŠçã§ããŸãã
ã³ãŒãæ§é
nginxã®ã¯ãŒã«ãŒã«ã¯ãã«ãŒãã«ãšæ©èœã¢ãžã¥ãŒã«ãå«ãŸããŠããŸãã nginxã«ãŒãã«ã¯ãããã»ã¹ã®åã¹ãããã§ã¢ãžã¥ãŒã«ã³ãŒãã®é©åãªã»ã¯ã·ã§ã³ã®å®è¡ãµã€ã¯ã«ãšå®è¡ãç¶æãã責任ããããŸãã ã¢ãžã¥ãŒã«ã¯ãã¢ããªã±ãŒã·ã§ã³å±€ã®ã»ãšãã©ã®æ©èœãæäŸããŸãã ãŸããã¢ãžã¥ãŒã«ã¯ãããã¯ãŒã¯ãšã¹ãã¬ãŒãžã®èªã¿åããšæžã蟌ã¿ãã³ã³ãã³ãã®å€æãéä¿¡ãã£ã«ã¿ãªã³ã°ã®å®è¡ããããã·ã¢ãŒãã®å Žåã¯äžæµãµãŒããŒãžã®ãªã¯ãšã¹ãã®éä¿¡ãè¡ããŸãã
nginxã®ã¢ãžã¥ãŒã«ã¢ãŒããã¯ãã£ã«ãããéçºè ã¯ã³ã¢ã®ã³ãŒããå€æŽããããšãªããWebãµãŒããŒã®æ©èœã»ãããæ¡åŒµã§ããŸãã ã«ãŒãã«ã¢ãžã¥ãŒã«ãã€ãã³ãã¢ãžã¥ãŒã«ããã§ãŒãºãã³ãã©ãŒããããã³ã«ããã£ã«ã¿ãŒãããŒããã©ã³ãµãŒãå€æ°ãã³ãã©ãŒãªã©ãnginxã¢ãžã¥ãŒã«ã«ã¯ããã€ãã®çš®é¡ããããŸãã åæã«ãnginxã¯åçã«ããŒããããã¢ãžã¥ãŒã«ããµããŒãããŠããŸãããã€ãŸããã¢ã»ã³ããªäœæ段éã§ã«ãŒãã«ãšäžç·ã«ã³ã³ãã€ã«ãããŸãã éçºè ã¯ãä»åŸããŠã³ããŒãå¯èœãªã¢ãžã¥ãŒã«ã®æ©èœãè¿œå ããäºå®ã§ãã
ãããã¯ãŒã¯æ¥ç¶ã®åä¿¡ãåŠçã管çãã³ã³ãã³ãã®ããŠã³ããŒãã«é¢é£ããããŸããŸãªã¢ã¯ãã£ããã£ãæŽçããããã«ãnginxã¯éç¥ã¡ã«ããºã ãšããã€ãã®ã¡ã«ããºã ã䜿çšããŠãkqueueãepollãã€ãã³ãããŒããªã©ãLinuxãSolarisãããã³BSDã·ã¹ãã ã®ãã£ã¹ã¯I / Oããã©ãŒãã³ã¹ãåäžãããŸãã
次ã®å³ã«ãnginxã¢ãŒããã¯ãã£ã®æŠèŠã瀺ããŸãã
åŽåè ã¢ãã«
äžèšã®ããã«ãnginxã¯æ¥ç¶ããšã«ããã»ã¹ãŸãã¯ã¹ã¬ãããäœæããŸããã 代ããã«ãç¹å¥ãªã¯ãŒã«ãŒãå ±éã®ããªã¹ãã³ã°ããœã±ããããã®æ°ãããªã¯ãšã¹ãã®åä¿¡ãåŠçããåã¯ãŒã«ãŒããã»ã¹å ã§éåžžã«å¹ççãªå®è¡ãµã€ã¯ã«ãéå§ããŸããããã«ããã1ã€ã®ã¯ãŒã«ãŒã«å¯ŸããŠæ°åã®æ¥ç¶ãåŠçã§ããŸãã nginxã®ç°ãªãã¯ãŒã«ãŒããã»ã¹éã§æ¥ç¶ãåæ£ããããã®ç¹å¥ãªã¡ã«ããºã ã¯ãããŸããããã®äœæ¥ã¯OSã®ã«ãŒãã«ã§å®è¡ãããŸãã ããŒãããã»ã¹äžã«ããªã¹ãã³ã°ãœã±ããã®ã»ãããäœæãããã¯ãŒââã«ãŒã¯HTTPãªã¯ãšã¹ããšã¬ã¹ãã³ã¹ã®åŠçäžã«åžžã«ãœã±ãããåä¿¡ãèªã¿åããæžã蟌ã¿ããŸãã
nginxã¯ãŒã«ãŒã®ã³ãŒãã®æãé£ããéšåã¯ãå®è¡ã«ãŒãã®èª¬æã§ãã ããã«ã¯ããããçš®é¡ã®å éšåŒã³åºããå«ãŸããéåæã¿ã¹ã¯åŠçã®æŠå¿µãç©æ¥µçã«äœ¿çšããŸãã éåææäœã¯ãã¢ãžã¥ãŒã«æ§ãã€ãã³ãã¢ã©ãŒããããã³ã³ãŒã«ããã¯é¢æ°ãšä¿®æ£ãããã¿ã€ããŒã®åºç¯ãªäœ¿çšãéããŠå®è£ ãããŸãã ãã®ãã¹ãŠã®äž»ãªç®æšã¯ãããã¯ãã§ããã ã䜿çšããªãããšã§ãã nginxããããã䜿çšã§ããå¯äžã®ã±ãŒã¹ã¯ããã£ã¹ã¯ã¹ãã¬ãŒãžããã©ãŒãã³ã¹ã¯ãŒã«ãŒããã»ã¹ãååã§ãªãå Žåã§ãã
nginxã¯æ¥ç¶ããšã«ããã»ã¹ãšã¹ã¬ãããäœæããªããããã»ãšãã©ã®å ŽåãWebãµãŒããŒã¯éåžžã«ä¿å®çã§ãããã¡ã¢ãªã«é¢ããŠéåžžã«å¹ççã§ãã ããã«ãnginxã®å Žåãããã»ã¹ãšã¹ã¬ããã®ç¶ç¶çãªäœæãšç Žæ£ã®ãã¿ãŒã³ããªããããããã»ããµãµã€ã¯ã«ãç¯çŽããŸãã Nginxã¯ãããã¯ãŒã¯ãšã¹ãã¬ãŒãžã®ã¹ããŒã¿ã¹ã確èªããæ°ããæ¥ç¶ãåæåããå®è¡ãµã€ã¯ã«ã«è¿œå ããããããåå©ã®çµãããã«éåæçã«åŠçããŸãããã®åŸãæ¥ç¶ã¯éã¢ã¯ãã£ãåããããµã€ã¯ã«ããé€å€ãããŸãã ãã®ã¡ã«ããºã ãšãã·ã¹ãã ã³ãŒã«ã®æ éãªäœ¿çšãããã³ã¡ã¢ãªã¢ãã±ãŒã¿ãŒïŒããŒã«ãã¹ã©ãïŒãªã©ã®ãµããŒãã€ã³ã¿ãŒãã§ã€ã¹ã®è³ªã®é«ãå®è£ ã®ãããã§ãnginxã䜿çšãããšã極端ãªè² è·ã®å Žåã§ãäœãŸãã¯äžã®CPUè² è·ãå®çŸã§ããŸãã
è€æ°ã®ã¯ãŒã«ãŒããã»ã¹ã䜿çšããŠæ¥ç¶ãåŠçãããšãè€æ°ã®ã³ã¢ãæäœããããã®WebãµãŒããŒã®ã¹ã±ãŒã©ããªãã£ãåäžããŸãã ãã«ãã³ã¢ã¢ãŒããã¯ãã£ã®å¹æçãªäœ¿çšã¯ãã³ã¢ããšã«1ã€ã®ã¯ãŒã«ãŒããã»ã¹ãäœæããããšã§ä¿èšŒãããã¹ã¬ããã®ãããã¯ãšã¹ã©ãã·ã³ã°ãåé¿ããŸãã ãªãœãŒã¹å¶åŸ¡ã¡ã«ããºã ã¯ãã·ã³ã°ã«ã¹ã¬ããã¯ãŒã«ãŒããã»ã¹å ã§åé¢ãããŠããŸãããã®ã¢ãã«ã¯ãç©çã¹ãã¬ãŒãžããã€ã¹ã®ã¹ã±ãŒãªã³ã°ãããå¹ççã«ãããã£ã¹ã¯äœ¿çšçãé«ãããã£ã¹ã¯I / Oã®ãããã¯ãåé¿ããŸãã ãã®çµæããµãŒããŒãªãœãŒã¹ãããå¹ççã«äœ¿çšãããè² è·ãè€æ°ã®ã¯ãŒã«ãŒããã»ã¹éã§åæ£ãããŸãã
ããã»ããµãšãã£ã¹ã¯ã®èªã¿èŸŒã¿ãã¿ãŒã³ãç°ãªãå Žåãnginxã¯ãŒã«ãŒããã»ã¹ã®æ°ã¯ç°ãªãå ŽåããããŸãã WebãµãŒããŒã®éçºè ã¯ãã·ã¹ãã 管çè ãããŸããŸãªæ§æãªãã·ã§ã³ãè©ŠããŠãããã©ãŒãã³ã¹ã®é¢ã§æé«ã®çµæãåŸãããã«æšå¥šããŠããŸãã ãã¿ãŒã³ããéäžçãªCPUè² è·ããšè¡šçŸã§ããå Žå-ããšãã°ãå€æ°ã®TCP / IPæ¥ç¶ãåŠçããå Žåãå§çž®ãå®è¡ããå ŽåããŸãã¯SSLã䜿çšããå Žåããã¯ãŒã«ãŒãã®æ°ã¯ã³ã¢ã®æ°ãšäžèŽããå¿ èŠããããŸãã è² è·ãäž»ã«ãã£ã¹ã¯ã·ã¹ãã ã«ãããå Žå-ããšãã°ãã¹ãã¬ãŒãžãã倧éã®ã³ã³ãã³ããããŒãããã³ã¢ã³ããŒãããå¿ èŠãããå Žå-ã¯ãŒã«ãŒããã»ã¹ã®æ°ã¯ãã³ã¢æ°ã®1.5ã2åã«ãªããŸãã
WebãµãŒããŒã®å°æ¥ã®ããŒãžã§ã³ã§ã¯ãnginxã®éçºè ã¯ããã£ã¹ã¯I / Oã®ãããã¯ç¶æ³ã®åé¡ã解決ããäºå®ã§ãã ãã®èšäºã®å·çæç¹ã§ãç¹å®ã®ã¯ãŒã«ãŒããã»ã¹ã®ãã£ã¹ã¯æäœãå®è¡ããéã®ã¹ãã¬ãŒãžããã©ãŒãã³ã¹ãäžååãªå Žåãèªã¿åããŸãã¯æžã蟌ã¿ã®æ©èœããããã¯ãããå¯èœæ§ããããŸãã ãã®å¯èœæ§ãæå°éã«æããããã«ãæ§æãã¡ã€ã«ãã£ã¬ã¯ãã£ããšæ¢åã®ã¡ã«ããºã ã®ããŸããŸãªçµã¿åããã䜿çšã§ããŸããããšãã°ãsendfileãªãã·ã§ã³ãšAIOãªãã·ã§ã³ã¯éåžžãã¹ãã¬ãŒãžã®ããã©ãŒãã³ã¹ãå€§å¹ ã«åäžãããããšãã§ããŸãã
æ¢åã®ã¯ãŒã«ãŒããã»ã¹ã¢ãã«ã®ãã1ã€ã®åé¡ã¯ãåã蟌ã¿ã¹ã¯ãªããã®ãµããŒããå¶éãããŠããããšã§ãã nginxã®æšæºããŒãžã§ã³ã®å ŽåãPerlã¹ã¯ãªããã®åã蟌ã¿ã®ã¿ãå©çšå¯èœã§ãã ãã®ç¶æ³ã«ã€ããŠç°¡åã«èª¬æããŸã-äž»ãªåé¡ã¯ãæäœäžã«åã蟌ã¿ã¹ã¯ãªããããããã¯ãããããäºæããçµäºããå¯èœæ§ã§ãã ã©ã¡ãã®å Žåããã¯ãŒã«ãŒããã»ã¹ãããªãŒãºããäžåºŠã«æ°åã®æ¥ç¶ã«åœ±é¿ãäžããå¯èœæ§ããããŸãã
Nginxããã»ã¹ã®åœ¹å²
Nginxã¯ã¡ã¢ãªå ã®ããã€ãã®ããã»ã¹ãéå§ããŸã-1ã€ã®ãã¹ã¿ãŒããã»ã¹ãšè€æ°ã®ãã¯ãŒã«ãŒãã ãããŒãžã£ãŒããã£ãã·ã¥ããŒããŒãªã©ãããã€ãã®ãµãŒãã¹ããã»ã¹ããããŸãã nginxããŒãžã§ã³1.xã§ã¯ããã¹ãŠã®ããã»ã¹ã¯ã·ã³ã°ã«ã¹ã¬ããã§ãã ãããã¯ãã¹ãŠãã¡ã¢ãªå ±æã¡ã«ããºã ã䜿çšããŠçžäºã«å¯Ÿè©±ããŸãã ãã¹ã¿ãŒããã»ã¹ã¯ã«ãŒããšããŠå®è¡ãããŸãã ãµãŒãã¹ããã³ã¯ãŒã«ãŒããã»ã¹ã¯ãã¹ãŒããŒãŠãŒã¶ãŒæš©éãªãã§æ©èœããŸãã
ãã¹ã¿ãŒããã»ã¹ã¯ã次ã®ã¿ã¹ã¯ãæ åœããŸãã
- èªã¿åããšæ§æã®æ€èšŒã
- ãœã±ãããäœæããã€ã³ããããã³éããŸãã
- èšå®ãããæ°ã®ã¯ãŒã«ãŒããã»ã¹ã®éå§ãäžæãããã³ãµããŒãã
- ãµãŒãã¹ãäžæããããšãªãåæ§æã
- äžå®ã®ãã€ããªæŽæ°ã®å¶åŸ¡ïŒæ°ããããã€ããªãã®èµ·åãšãå¿ èŠã«å¿ããŠåã®ããŒãžã§ã³ãžã®ããŒã«ããã¯ïŒ;
- ãã°ãã¡ã€ã«ãå床éãã
- çµã¿èŸŒã¿Perlã¹ã¯ãªããã®ã³ã³ãã€ã«ã
å éšããã€ã¹nginxã¯ã ãã®èšäºã® Habréã§èª¬æãããŠããŸã
ã¯ãŒã«ãŒããã»ã¹ã¯ãã¯ã©ã€ã¢ã³ãããã®æ¥ç¶ãåãå ¥ããŠåŠçãããªããŒã¹ãããã·ããã³ãã£ã«ã¿ãªã³ã°æ©èœãæäŸããnginxãè¡ãã¹ãã»ãŒãã¹ãŠã®ããšãè¡ããŸãã äžè¬ã«ãWebãµãŒããŒã®çŸåšã®ç¶æ ã远跡ããã«ã¯ãã·ã¹ãã 管çè ã¯[ç¶æ ]ãæãããåæ ããŠãããããã¯ãŒã«ãŒã調ã¹ãå¿ èŠããããŸãã
ãã£ãã·ã¥ããŒããŒããã»ã¹ã¯ããã£ã¹ã¯äžã®ãã£ãã·ã¥ã«ããã¢ã€ãã ããã§ãã¯ããã¡ã¢ãªã«ä¿åãããŠããã¡ã¿ããŒã¿ãæŽæ°ããŸãã ããŒãããŒããŒã¯ãæ¢ã«ãã£ã¹ã¯ã«ä¿åãããŠãããã¡ã€ã«ãæäœããããã«nginxã€ã³ã¹ã¿ã³ã¹ãæºåããŸãã ãã£ã¬ã¯ããªã調ã¹ãŠããã£ãã·ã¥å ã®ã³ã³ãã³ãã®ã¡ã¿ããŒã¿ã調ã¹ãå ±æã¡ã¢ãªå ã®å¿ èŠãªèŠçŽ ãæŽæ°ããŠããçµäºããŸãã
ãã£ãã·ã¥ãããŒãžã£ãŒã¯ãäž»ã«ãã£ãã·ã¥ã®é¢é£æ§ãç£èŠããŸãã WebãµãŒããŒã®éåžžã®åäœäžã¯ãWebãµãŒããŒã¯ã¡ã¢ãªå ã«ãããé害ãçºçããå Žåããã¹ã¿ãŒããã»ã¹ã¯WebãµãŒããŒãåèµ·åããŸãã
nginxã§ã®ãã£ãã·ã¥ã®æŠèŠ
nginxã§ã¯ããã£ãã·ã¥ã¯ãã¡ã€ã«ã·ã¹ãã ã®éå±€ããŒã¿ã¹ãã¢ã®åœ¢åŒã§å®è£ ãããŸãã ãã£ãã·ã¥ããŒãæ§æã§ããããŸããŸãªã¯ãšãªãã©ã¡ãŒã¿ãŒã䜿çšããŠããã£ãã·ã¥ããŒã«å ¥ãããã®ãå¶åŸ¡ã§ããŸãã ãã£ãã·ã¥ããŒãšã¡ã¿ããŒã¿ã¯å ±æã¡ã¢ãªã»ã°ã¡ã³ãã«æ ŒçŽãããã¯ãŒââã«ãŒãããŒããŒããã£ãã·ã¥ãããŒãžã£ãŒããã¢ã¯ã»ã¹ã§ããŸãã çŸæç¹ã§ã¯ãnginxã«ã¯ãOSã®ä»®æ³ãã¡ã€ã«ã·ã¹ãã ã®ã¡ã«ããºã ãæäœãããšãã«å©çšã§ããæé©åã®æ©äŒãé€ããŠãå éšã¡ã¢ãªã«ãã¡ã€ã«ããã£ãã·ã¥ããæ©èœããããŸããã ãã£ãã·ã¥ãããåå¿çã¯ãåå¥ã®ãã¡ã€ã«ã·ã¹ãã ãã¡ã€ã«ã«é 眮ãããŸãã éå±€ã¯ãnginxæ§æãã£ã¬ã¯ãã£ãã䜿çšããŠå¶åŸ¡ãããŸãã å¿çããã£ãã·ã¥ãã£ã¬ã¯ããªæ§é ã«æžã蟌ãŸãããšããããã·URLã®MD5ããã·ã¥ãããã¹ãšãã¡ã€ã«åãååŸãããŸãã
ã³ã³ãã³ãããã£ãã·ã¥ã«é 眮ããããã»ã¹ã¯æ¬¡ã®ãšããã§ããnginxãäžæµãµãŒããŒããå¿çãèªã¿åããšãã³ã³ãã³ãã¯ãŸããã£ãã·ã¥ãã£ã¬ã¯ããªæ§é å€ã®äžæãã¡ã€ã«ã«æžã蟌ãŸããŸãã WebãµãŒããŒã¯èŠæ±ã®åŠçãå®äºãããšãäžæãã¡ã€ã«ã®ååãå€æŽãããã£ãã·ã¥ãã£ã¬ã¯ããªã«ç§»åããŸãã äžæãã¡ã€ã«ãã£ã¬ã¯ããªãå¥ã®ãã¡ã€ã«ã·ã¹ãã ã«ããå Žåããã¡ã€ã«ã¯ã³ããŒããããããäžæãã¡ã€ã«ãšãã£ãã·ã¥ãã£ã¬ã¯ããªãåããã¡ã€ã«ã·ã¹ãã ã«é 眮ããããšããå§ãããŸãã ããã«ãã»ãã¥ãªãã£ã®èŠ³ç¹ããããã£ãã·ã¥ãããã³ã³ãã³ããžã®ãªã¢ãŒãã¢ã¯ã»ã¹ãæäŸã§ããnginxã«ã¯ãµãŒãããŒãã£ã®æ¡åŒµæ©èœãããããããã¡ã€ã«ãã¯ãªã¢ããå¿ èŠãããå Žåããã£ãã·ã¥ãããã¡ã€ã«ãåé€ããããšãè¯ã解決çã«ãªããŸãã
Nginxèšå®
Igor Sysoevã¯ãApacheã§nginxæ§æã·ã¹ãã ãäœæããçµéšã«è§ŠçºãããŸããã éçºè ã¯ãWebãµãŒããŒã«ã¯ã¹ã±ãŒã©ãã«ãªæ§æã·ã¹ãã ãå¿ èŠã§ãããšèããŠããŸããã ãããŠãå€ãã®ä»®æ³ãµãŒããŒããã£ã¬ã¯ããªãããã³ããŒã¿ã»ãããåããå€æ°ã®è€éãªæ§æããµããŒãããå¿ èŠããããšãã«ãã¹ã±ãŒã©ããªãã£ã®äž»ãªåé¡ãçºçããŸããã æ¯èŒç倧èŠæš¡ãªWebã€ã³ãã©ã¹ãã©ã¯ãã£ããµããŒãããã³ã¹ã±ãŒãªã³ã°ãããšãå°çã«é¥ãããšããããŸãã
ãã®çµæãnginxã®æ§æã¯ãWebãµãŒããŒããµããŒãããæ¥åžžçãªæäœãç°¡çŽ åããã·ã¹ãã ãããã«æ¡åŒµããããã®ããŒã«ãæäŸããããã«èšèšãããŸããã
nginxã®èšå®ã¯ããã€ãã®ããã¹ããã¡ã€ã«ã«ä¿åãããŸãããããã®ãã¡ã€ã«ã¯éåžžã/ usr / local / etc / nginxãŸãã¯/ etc / nginxãã£ã¬ã¯ããªã«ãããŸãã ã¡ã€ã³ã®æ§æãã¡ã€ã«ã¯ãéåžžnginx.confãšåŒã°ããŸãã èªã¿ãããããããã«ãæ§æã®äžéšãç°ãªããã¡ã€ã«ã«åå²ããããããã¡ã€ã³ã®ãã¡ã€ã«ã«å«ããããšãã§ããŸãã nginxã¯.htaccessãã¡ã€ã«ããµããŒãããŠããªãããšã«æ³šæããããšãéèŠã§ãããã¹ãŠã®æ§ææ å ±ã¯ãäžå åããããã¡ã€ã«ã»ããã«é 眮ããå¿ èŠããããŸãã
æ§æãã¡ã€ã«ã®æåã®èªã¿åããšæ€èšŒã¯ããã¹ã¿ãŒããã»ã¹ã«ãã£ãŠå®è¡ãããŸãã èªã¿åãçšã«ã³ã³ãã€ã«ãããæ§æãã©ãŒã ã¯ããã¹ã¿ãŒããã»ã¹ããéžæãããåŸãã¯ãŒã«ãŒããã»ã¹ã§äœ¿çšã§ããŸãã æ§ææ§é ã¯ãä»®æ³ã¡ã¢ãªç®¡çã¡ã«ããºã ã«ãã£ãŠèªåçã«å ±æãããŸãã
ãããã¯ãšãã£ã¬ã¯ãã£ãã®ã¡ã€ã³ãhttpããµãŒããŒãã¢ããã¹ããªãŒã ããã±ãŒã·ã§ã³ïŒã¡ãŒã«ãã¡ãŒã«ãããã·çšïŒã«ã¯ããã€ãã®ç°ãªãã³ã³ããã¹ãããããŸãã ããšãã°ãã¡ã€ã³ãã£ã¬ã¯ãã£ããããã¯ã«ãã±ãŒã·ã§ã³ãããã¯ãé 眮ããããšã¯ã§ããŸããã ãŸããäžèŠãªè€éããè¿œå ããªãããã«ãnginxã«ã¯ãã°ããŒãã«WebãµãŒããŒãèšå®ã¯ãããŸããã ã·ãœãšãèªèº«ãèšãããã«ïŒ
ã°ããŒãã«WebãµãŒããŒèšå®ã®å Žæããã£ã¬ã¯ããªãããã³ãã®ä»ã®ãããã¯ã¯ãApacheã§ã¯æ±ºããŠå¥œãã§ã¯ãªãã£ããããnginxã«ã¯ç»å ŽããŸããã§ããã
nginxæ§æã®æ§æãšãã©ãŒãããã¯ãCã³ãŒãã¹ã¿ã€ã«ã®æšæºïŒãCã¹ã¿ã€ã«ã®èŠåãïŒã«åŸããŸãã äžéšã®nginxãã£ã¬ã¯ãã£ãã¯Apacheæ§æã®ç¹å®ã®éšåãåæ ããŠããŸããã2ã€ã®WebãµãŒããŒã®å šäœçãªæ§æã¯å€§ããç°ãªããŸãã ããšãã°ãnginxã¯æžãæãã«ãŒã«ããµããŒãããŠãããApacheã®å Žåã管çè ã¯ãã®ããã«ã¬ã¬ã·ãŒæ§æãæåã§èª¿æŽããå¿ èŠããããŸãã æžãæããšã³ãžã³ã®å®è£ ãç°ãªããŸãã
Nginxã¯ãããã€ãã®äŸ¿å©ãªç¬èªã®ã¡ã«ããºã ããµããŒãããŠããŸãã ããšãã°ãå€æ°ãštry_filesãã£ã¬ã¯ãã£ãã nginxã§ã¯ãå€æ°ã䜿çšããŠãWebãµãŒããŒã®å®è¡æèšå®ãå¶åŸ¡ãã匷åãªã¡ã«ããºã ãå®è£ ããŸãã ããããããŸããŸãªæ§æãã£ã¬ã¯ãã£ããšãšãã«äœ¿çšããŠãèŠæ±ãåŠçããããã®æ¡ä»¶ãããæè»ã«èšè¿°ããããšãã§ããŸãã
try_filesãã£ã¬ã¯ãã£ãã¯å ã ãæ¡ä»¶ä»ãifã¹ããŒãã¡ã³ãã®ä»£æ¿ãšããŠããŸãç°ãªãURLãšã³ã³ãã³ããè¿ éãã€å¹ççã«ç §åããããã«äœæãããŸããã
Nginxå éšããã€ã¹
Nginxã¯ãã«ãŒãã«ãšããã€ãã®ã¢ãžã¥ãŒã«ã§æ§æãããŠããŸãã ã«ãŒãã«ã¯ãWebãµãŒããŒã®åºç€ãWebæ©èœã®æäœããªããŒã¹ãããã·ã®äœæãæ åœããŸãã ãŸãããããã¯ãŒã¯ãããã³ã«ã®äœ¿çšãèµ·åç°å¢ã®æ§ç¯ãç°ãªãã¢ãžã¥ãŒã«éã®ã·ãŒã ã¬ã¹ãªéä¿¡ã®ç¢ºä¿ãæ åœããŸãã ãã ãããããã³ã«ãšã¢ããªã±ãŒã·ã§ã³ã«é¢é£ããæ©èœã®ã»ãšãã©ã¯ãã«ãŒãã«ã§ã¯ãªãã¢ãžã¥ãŒã«ã䜿çšããŠå®è£ ãããŸãã
æ¥ç¶ã¯ããã€ããŸãã¯ã¢ãžã¥ãŒã«ãã§ãŒã³ã䜿çšããŠnginxã«ãã£ãŠåŠçãããŸãã ã€ãŸããåæäœã«å¿ èŠãªäœæ¥ãå®è¡ããã¢ãžã¥ãŒã«ããããŸããããšãã°ãå§çž®ãã³ã³ãã³ãã®å€æŽããµãŒããŒã®çµã¿èŸŒã¿ãFastCGIãŸãã¯uwsgiãããã³ã«ãä»ããå€éšãµãŒããŒãšã®ããåããmemchahedãšã®éä¿¡ãªã©ã§ãã
ã«ãŒãã«ãšãæ©èœãã¢ãžã¥ãŒã«ã®éã«ããããã€ãã®ã¢ãžã¥ãŒã«ããããŸã-ãããã¯httpããã³ã¡ãŒã«ã¢ãžã¥ãŒã«ã§ãã ãããã¯ãã³ã¢ã³ã³ããŒãã³ããšäœã¬ãã«ã³ã³ããŒãã³ãéã®è¿œå ã®æœè±¡åã¬ãã«ãæäŸããŸãã 圌ãã®å©ããåããŠãHTTPãSMTPãIMAPãªã©ã®ç¹å®ã®ãããã¯ãŒã¯ãããã³ã«ã«é¢é£ããäžé£ã®ã€ãã³ãã®åŠçãå®è£ ãããŠããŸãã ã«ãŒãã«ãšãšãã«ããããã®é«ã¬ãã«ã¢ãžã¥ãŒã«ã¯ã察å¿ããæ©èœã¢ãžã¥ãŒã«ã®åŒã³åºãã®æ£ããé åºãç¶æãã責任ããããŸãã çŸåšãHTTPãããã³ã«ã¯httpã¢ãžã¥ãŒã«ã®äžéšãšããŠå®è£ ãããŠããŸãããå°æ¥ãéçºè ã¯ãããå¥ã®æ©èœã¢ãžã¥ãŒã«ã«åé¢ããäºå®ã§ã-ããã¯ãä»ã®ãããã³ã«ïŒããšãã°ã SPDY ïŒããµããŒãããå¿ èŠæ§ã«ãã£ãŠæ±ºãŸããŸãã
ã»ãšãã©ã®æ¢åã®ã¢ãžã¥ãŒã«ã¯nginx HTTPæ©èœãè£å®ããŸãããã€ãã³ãã¢ãžã¥ãŒã«ãšãããã³ã«ã¢ãžã¥ãŒã«ã¯ã¡ãŒã«ã®åŠçã«ã䜿çšãããŸãã ã€ãã³ãã¢ãžã¥ãŒã«ã¯ãkqueueãepollãªã©ãããŸããŸãªãªãã¬ãŒãã£ã³ã°ã·ã¹ãã ã«ã€ãã³ãéç¥ã¡ã«ããºã ãæäŸããŸãã nginxã䜿çšããã¢ãžã¥ãŒã«ã®éžæã¯ããã«ãæ§æãšãªãã¬ãŒãã£ã³ã°ã·ã¹ãã ã®æ©èœã«äŸåããŸãã ãããã³ã«ã¢ãžã¥ãŒã«ã«ãããnginxã¯HTTPSãTLS / SSLãSMTPãPOP3ãããã³IMAPãä»ããŠåäœã§ããŸãã
ããã¯å žåçãªHTTPãªã¯ãšã¹ãåŠçã«ãŒãã®ããã§ãïŒ
- ã¯ã©ã€ã¢ã³ãã¯HTTPãªã¯ãšã¹ããéä¿¡ããŸãã
- ã«ãŒãã«ã¯ãnginxèŠæ±çšã«æ§æãããå Žæã«åŸã£ãŠãç®çã®ãã§ãŒãºãã³ãã©ãŒãéžæããŸãã
- ãããã·æ©èœãæå¹ã«ãªã£ãŠããå ŽåãããŒããã©ã³ãµãŒã¯ãããã·ç®çã§äžäœã®ãµãŒããŒãéžæããŸãã
- ãã§ãŒãºãã³ãã©ãŒã¯çµäºããåºåãããã¡ãŒãæåã®ãã£ã«ã¿ãŒã«æž¡ããŸãã
- æåã®ãã£ã«ã¿ãŒã¯ãåºåã2çªç®ã®ãã£ã«ã¿ãŒã«æž¡ããŸãã
- 2çªç®ã®ãã£ã«ã¿ãŒã¯ãåºåã3çªç®ã®ãã£ã«ã¿ãŒã«æž¡ããŸãïŒä»¥äžåæ§ïŒã
- æçµå¿çãã¯ã©ã€ã¢ã³ãã«éä¿¡ãããŸãã
nginxã®ã¢ãžã¥ãŒã«ã®åŒã³åºãã¯èšå®ã§ããå®è¡å¯èœãªé¢æ°ãžã®ãã€ã³ã¿ãŒãå«ãã³ãŒã«ããã¯ã䜿çšããŠå®è¡ãããŸãã ããã§ã®æ¬ ç¹ã¯ãéçºè ãç¬èªã®ã¢ãžã¥ãŒã«ãäœæããå Žåãã©ã®ããã«ã©ãã§èµ·åããããæ確ã«è¿°ã¹ãå¿ èŠãããããšã§ãã ããšãã°ããããçºçããå¯èœæ§ã®ãããã€ã³ãã¯æ¬¡ã®ãšããã§ãã
- æ§æãã¡ã€ã«ãèªã¿åã£ãŠåŠçããåã
- ã¡ã€ã³æ§æã®åæåæã
- ãµãŒããŒïŒãã¹ã/ããŒãïŒã®åæååŸã
- ãµãŒããŒæ§æãã¡ã€ã³æ§æãšããŒãžãããšãã
- ãã¹ã¿ãŒããã»ã¹ãéå§ãŸãã¯çµäºãããšãã
- æ°ããã¯ãŒã«ãŒããã»ã¹ã®éå§æãŸãã¯çµäºæã
- ãªã¯ãšã¹ãã®åŠçæã
- å¿çã®ããããŒãšæ¬æããã£ã«ã¿ãªã³ã°ããããã»ã¹ã
- äžæµãµãŒããŒãžã®èŠæ±ã®åæããã³ååæåãéžæãããšãã
- ã¢ããã¹ããªãŒã ãµãŒããŒããã®å¿çãåŠçããããã»ã¹ã
- ãã®ãµãŒããŒãšã®å¯Ÿè©±ã®å®äºæã
ã¯ãŒã«ãŒå ã§ã¯ãå¿çãçæãããåŠçãµã€ã¯ã«ã«è³ãäžé£ã®ã¢ã¯ã·ã§ã³ã¯æ¬¡ã®ãšããã§ãã
- ngx_worker_process_cycleïŒïŒãéå§ããŸãã
- ã€ãã³ãã¯ãOSã¡ã«ããºã ïŒepollãkqueueãªã©ïŒã䜿çšããŠåŠçãããŸãã
- ã€ãã³ããåãå ¥ãããã察å¿ããã¢ã¯ã·ã§ã³ãéä¿¡ãããŸãã
- ããã»ã¹/ãããã·ã¯ããããŒãšæ¬æãèŠæ±ããŸãã
- å¿çã³ã³ãã³ãïŒããããŒãå¿çïŒãçæãããã¯ã©ã€ã¢ã³ãã«éä¿¡ãããŸãã
- ãªã¯ãšã¹ãã確å®ããŸãã
- ã¿ã€ããŒãšã€ãã³ããååæåãããŸãã
HTTPèŠæ±ã®åŠçã®ãã詳现ãªèª¬æã¯ã次ã®ããã«è¡šãããšãã§ããŸãã
- èŠæ±åŠçã®åæåã
- ããããŒåŠçã
- ããã£ããªãŒãã¡ã³ãã
- é©åãªãã³ãã©ãŒãåŒã³åºããŸãã
- åŠç段éã®ééã
èŠæ±ãåŠçããéçšã§ãèŠæ±ã¯ããã€ãã®æ®µéãçµãŸãã ãããã®ããããã§ã察å¿ãããã³ãã©ãŒãåŒã³åºãããŸãã éåžžã4ã€ã®ã¿ã¹ã¯ãå®è¡ããŸããå Žæã®æ§æãååŸããé©åãªå¿çãçæããããããŒãéä¿¡ããŠããæ¬æãéä¿¡ããŸãã ãã³ãã©ãŒã«ã¯1ã€ã®åŒæ°ããããŸããèŠæ±ãèšè¿°ããç¹å®ã®æ§é ã§ãã ãªã¯ãšã¹ãæ§é ã«ã¯ããªã¯ãšã¹ãã¡ãœãããURLãã¿ã€ãã«ãªã©ã倧éã®æçšãªæ å ±ãå«ãŸããŠããŸãã
HTTPãªã¯ãšã¹ãã®ããããŒãèªã¿åã£ãåŸãnginxã¯é¢é£ä»ããããä»®æ³ãµãŒããŒæ§æã調ã¹ãŸãã ä»®æ³ãµãŒããŒãèŠã€ãã£ãå ŽåãèŠæ±ã¯6ã€ã®ãã§ãŒãºãééããŸãã
- ãµãŒããŒæžãæããã§ãŒãºã
- ãã¬ãŒãºæ€çŽ¢ã®å ŽæïŒå ŽæïŒã
- å ŽæãäžæžãããŸãã
- ã¢ã¯ã»ã¹å¶åŸ¡ãã§ãŒãºã
- try_filesã®äœæ¥ãã§ãŒãºã
- ãã®ã³ã°ãã§ãŒãºã
èŠæ±ã«å¿ããŠã³ã³ãã³ããäœæããããã»ã¹ã§ãnginxã¯ãããããŸããŸãªã³ã³ãã³ããã³ãã©ãŒã«æž¡ããŸãã ãŸããèŠæ±ã¯ãperlãproxy_passãflvãmp4ãªã©ã®ããããç¡æ¡ä»¶ãã³ãã©ãŒã«å°éã§ããŸãã èŠæ±ããããã®ã³ã³ãã³ããã³ãã©ã®ãããã«ãé©åããªãå Žåããã§ãŒã³ã«æ²¿ã£ãŠæ¬¡ã®ãã³ãã©ã«éä¿¡ãããŸãïŒã©ã³ãã ã€ã³ããã¯ã¹ãã€ã³ããã¯ã¹ãèªåã€ã³ããã¯ã¹ãgzip_staticãéçã
mp4ãautoindexã®ãããªç¹æ®ãªã¢ãžã¥ãŒã«ãé©åããªãå Žåãã³ã³ãã³ãã¯ãã£ã¹ã¯äžã®ãã£ã¬ã¯ããªïŒã€ãŸããéçïŒãšèŠãªãããéçã³ã³ãã³ããã³ãã©ãŒããããæ åœããŸãã
ãã®åŸãã³ã³ãã³ãã¯ç¹å®ã®ã¹ããŒã ã«åŸã£ãŠæ©èœãããã£ã«ã¿ãŒã«éä¿¡ãããŸãã ãã§ãŒã³å ã®æåŸã®ãã£ã«ã¿ãŒãåŒã³åºããããŸã§ããã£ã«ã¿ãŒã¯åŒã³åºããåãåããåäœãéå§ãã次ã®ãã£ã«ã¿ãŒãåŒã³åºããŸãã ããããŒãšæ¬æã®ãã£ã«ã¿ãŒããããŸãã ããããŒãã£ã«ã¿ãŒã®æäœã¯ã3ã€ã®äž»èŠãªæé ã§æ§æãããŸãã
- ãªã¯ãšã¹ãã«å¿ããã¢ã¯ã·ã§ã³ã®å¿ èŠæ§ã®å€æã
- ãªã¯ãšã¹ãåŠçã
- 次ã®ãã£ã«ã¿ãŒãåŒã³åºããŸãã
ããã£ãã£ã«ã¿ãŒã¯ãçæãããã³ã³ãã³ããå€æããŸãã å¯èœãªã¢ã¯ã·ã§ã³ã®äžã§ïŒ
- ãµãŒããŒã®å å«ã
- XSLTãã£ã«ã¿ãªã³ã°ã
- ç»åã®ãã£ã«ã¿ãªã³ã°ïŒããšãã°ããã®å Žã§ç»åã®ãµã€ãºãå€æŽããïŒã
- ãšã³ã³ãŒãã£ã³ã°ã®å€æŽã
- Gzipå§çž®ã
- ãã£ã³ã¯ãšã³ã³ãŒãã£ã³ã°
ãã£ã«ã¿ãŒãã§ãŒã³ãééããåŸãå¿çãã©ã€ã¿ãŒã«éä¿¡ãããŸãã ã³ããŒãšå»¶æãšãã2ã€ã®ç¹å¥ãªãã£ã«ã¿ãŒããããŸãã æåã®ãã®ã¯ã¡ã¢ãªãããã¡ãå¿çã®é¢é£ã³ã³ãã³ãã§åãã圹å²ãæããã2çªç®ã¯ãµãã¯ãšãªã«äœ¿çšãããŸãã
ãµãã¯ãšãªã¯ãèŠæ±ãšå¿çãåŠçããããã®éåžžã«éèŠã§éåžžã«åŒ·åãªã¡ã«ããºã ã§ãã nginx URL, . - , nginx â , . («-»), , , «--».
, . . , SSI- (server side include) , include URL-. , URL, URL .
nginx upstream-. . . Upstream- , , . :
- .
- ( ).
- , .
- ( ).
- , nginx .
- ( ).
proxy_pass â , . .
nginx , . nginx , , : geo map. geo IP-. , IP- . , map, , runtime-.
worker- nginx Apache. nginx : , , . Nginx - , memcpy.
nginx. , , SSL- , (). nginx slab-. ( ). nginx - . , -regex .
nginx:
- Understanding Nginx Server and Location Block Selection Algorithms
- Nginxèšå®ãã¡ã€ã«ã®æ§é ãšèšå®ã³ã³ããã¹ããç解ãã
- Nginxãæ§æããæ¹æ³
- ããã©ãŒãã³ã¹ã®ããã®NGINXã®ã€ã³ã¹ããŒã«ãšãã¥ãŒãã³ã°
- ããã©ãŒãã³ã¹ã®ããã®NGINXã®ãã¥ãŒãã³ã°
- NGINX 1.9.1ã®è€æ°ã®ãœã±ãã
- å éšããã®NGINXïŒããã©ãŒãã³ã¹ãšã¹ã±ãŒã©ããªãã£ã®ããã«çãŸãã
- Apache vs NginxïŒå®çšçãªå€èŠ³