nginxЧÀÍÆ÷¹ÒÁËÔõô°ì
µ± nginx ЧÀÍÆ÷å´»úʱ£¬¿ÉÖ´ÐÐÒÔϹÊÕÏɨ³ý°ì·¨£º¼ì²é nginx Àú³ÌÊÇ·ñÕýÔÚÔËÐС£Éó²é¹ýʧÈÕÖ¾ÒÔ»ñÈ¡¹ýʧÐÂÎÅ¡£¼ì²é nginx ÉèÖÃÓ﷨׼ȷÐÔ¡£È·±£ nginx ¾ßÓлá¼ûÎļþËùÐèµÄȨÏÞ¡£¼ì²éÎļþÐÎò·û·¿ªÏÞÖÆ¡£È·ÈÏ nginx ÕýÔÚÕìÌý׼ȷµÄ¶Ë¿Ú¡£Ìí¼Ó·À»ðǽ¹æÔòÒÔÔÊÐínginxÁ÷Á¿¡£¼ì²é·´ÏòÊðÀíÉèÖ㬰üÀ¨ºó¶ËЧÀÍÆ÷¿ÉÓÃÐÔ¡£ÈçÐè½øÒ»²½×ÊÖú£¬ÇëÁªÏµÊÖÒÕÖ§³Ö¡£
nginx ЧÀÍÆ÷å´»ú¹ÊÕÏɨ³ý
µ± nginx ЧÀÍÆ÷å´»úʱ£¬½ÓÄÉÒÔÏ°취¾ÙÐйÊÕÏɨ³ý£º
1. ¼ì²é nginx Àú³Ì
ʹÓà ps aux | grep nginx ÏÂÁî¼ì²é nginx ÊÇ·ñÕýÔÚÔËÐС£
ÈôÊÇûÓÐ nginx Àú³Ì£¬Ê¹Óà nginx ÏÂÁîÆô¶¯ nginx¡£
2. ¼ì²éÈÕÖ¾Îļþ
Éó²é nginx µÄ¹ýʧÈÕÖ¾£¨Í¨³£Î»ÓÚ /var/log/nginx/error.log£©ÒÔ²éÕÒ¹ýʧÐÂÎÅ¡£
³£¼ûµÄ¹ýʧʾÀý£ºÉèÖùýʧ¡¢ÎļþȨÏÞÎÊÌâ¡¢×ÊÔ´ÏÞÖÆ¡£
3. ¼ì²éÉèÖÃ
ʹÓà nginx -t ÏÂÁî¼ì²é nginx ÉèÖÃÓï·¨ÊÇ·ñ׼ȷ¡£
×Ðϸ¼ì²éÐéÄâÖ÷»úÉèÖᢹýʧÈÕ־λÖúÍÈκÎ×Ô½ç˵ÉèÖá£
4. ¼ì²éÎļþȨÏÞ
È·±£ nginx ¾ßÓлá¼ûÆäÉèÖÃÎļþ¡¢ÈÕÖ¾ÎļþºÍÍøÕ¾ÎļþËùÐèµÄȨÏÞ¡£
ʹÓà ls -la /etc/nginx/nginx.conf ºÍÆäËûÏà¹ØÎļþ¼ì²éÎļþȨÏÞ¡£
5. ¼ì²é×ÊÔ´ÏÞÖÆ
ʹÓà ulimit -n ÏÂÁî¼ì²é nginx Àú³Ì·¿ªÎļþÐÎò·ûµÄ×î´óÊýÄ¿¡£
ÈôÊÇÏÞÖÆÌ«µÍ£¬ÇëʹÓà ulimit -n ÔöÌíÏÞÖÆ¡£
6. ¼ì²éÍøÂçÅþÁ¬
È·±£ nginx ¼àÌý׼ȷµÄ¶Ë¿Ú£¨Í¨³£Îª 80 ºÍ 443£©¡£
ʹÓà netstat -tulpn | grep nginx ÏÂÁî¼ì²é nginx ÊÇ·ñÕýÔÚ¼àÌý¶Ë¿Ú¡£
7. ¼ì²é·À»ðǽ
È·ÈÏ·À»ðǽÔÊÐí nginx µÄÁ÷Á¿¡£
Ìí¼ÓÐëÒªµÄ·À»ðǽ¹æÔòÒÔÔÊÐí 80 ºÍ/»ò 443 ¶Ë¿ÚµÄÁ÷Á¿¡£
8. ¼ì²é·´ÏòÊðÀíÉèÖÃ
ÈôÊÇ nginx ÓÃ×÷·´ÏòÊðÀí£¬Çë¼ì²é·´ÏòÊðÀíÉèÖÃÊÇ·ñ׼ȷ¡£
ÑéÖ¤ºó¶ËЧÀÍÆ÷µÄ¿ÉÓÃÐÔºÍÏìӦʱ¼ä¡£
9. ÁªÏµÊÖÒÕÖ§³Ö
ÈôÊÇÉÏÊö°ì·¨ÎÞ·¨½â¾öÎÊÌ⣬ÇëÁªÏµ nginx ÊÖÒÕÖ§³Ö»òϵͳÖÎÀíÔ±ÒÔ»ñÈ¡½øÒ»²½µÄ×ÊÖú¡£
ÒÔÉϾÍÊÇnginxЧÀÍÆ÷¹ÒÁËÔõô°ìµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡