nginx¹ÒÁËÔõô°ì
nginx ·ºÆð¹ÊÕÏʱµÄ´¦Àí°ì·¨£º¼ì²éÀú³ÌÊÇ·ñÔËÐмì²é¹ýʧÈÕÖ¾»ñÈ¡¹ÊÕÏÔµ¹ÊÔÓɼì²éÉèÖÃÊÇ·ñ±£´æÓï·¨¹ýʧ»òÎÊÌâ¼à¿ØЧÀÍÆ÷×ÊÔ´È·±£¸»×ãÖØмÓÔØÉèÖÃÓ¦Óøü¸ÄÖØÆô nginx Àú³Ì¼ì²é·À»ðǽ¹æÔò¡¢ÉèÖÃÎļþ¡¢½ûÓõÚÈý·½Ä£¿é²¢²éÔÄ nginx Îĵµ»ñÈ¡¸ü¶à×ÊÖú¡£
nginx ¹ÒÁËÔõô°ì
µ± nginx ·ºÆð¹ÊÕÏʱ£¬¿ÉÒÔ½ÓÄÉÒÔÏ°취¾ÙÐйÊÕÏɨ³ýºÍ»Ö¸´£º
1. ¼ì²éÀú³Ì
ʹÓÃÒÔÏÂÏÂÁî¼ì²é nginx Àú³ÌÊÇ·ñÕýÔÚÔËÐУº
ps aux | grep nginx
µÇ¼ºó¸´ÖÆ
ÈôÊÇÀú³ÌûÓÐÔËÐУ¬ÇëʵÑéÆô¶¯Ëü£º
sudo service nginx start
µÇ¼ºó¸´ÖÆ
2. ¼ì²é¹ýʧÈÕÖ¾
Éó²é nginx ¹ýʧÈÕÖ¾ÒÔ»ñÈ¡ÓйعÊÕϵĸü¶àÐÅÏ¢£º
sudo cat /var/log/nginx/error.log
µÇ¼ºó¸´ÖÆ
¹ýʧÈÕÖ¾ÖпÉÄÜ»á°üÀ¨ÓйعýʧԵ¹ÊÔÓɵÄÏßË÷¡£
3. ¼ì²éÉèÖÃ
Óï·¨¹ýʧ»òÉèÖÃÎÊÌâ»áµ¼Ö nginx ¹ÊÕÏ¡£¼ì²é nginx ÉèÖÃÎļþ£¨Í¨³£Î»ÓÚ /etc/nginx/nginx.conf£©ÊÇ·ñÓйýʧ¡£ÌØÊâ¹Ø×¢£º
ЧÀÍÆ÷¿éÖеĹýʧ
ÉèÖÃÖ¸ÁîÖеÄÓï·¨¹ýʧ
ɥʧµÄ»òÎÞЧµÄÎļþ·¾¶
4. ¼à¿Ø×ÊÔ´
È·±£Ð§ÀÍÆ÷ÓÐ×ã¹»µÄ×ÊÔ´£¨ÀýÈçÄÚ´æºÍ CPU£©À´ÔËÐÐ nginx¡£¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÉó²éЧÀÍÆ÷¸ºÔØ£º
top -n 1
µÇ¼ºó¸´ÖÆ
ÈôÊÇЧÀÍÆ÷¸ºÔغܸߣ¬Çë˼Á¿Éý¼¶Ð§ÀÍÆ÷»òÓÅ»¯ nginx ÉèÖá£
5. ÖØмÓÔØÉèÖÃ
ÈôÊÇ¶Ô nginx ÉèÖþÙÐÐÁ˸ü¸Ä£¬ÇëʹÓÃÒÔÏÂÏÂÁîÖØмÓÔØÉèÖãº
sudo service nginx reload
µÇ¼ºó¸´ÖÆ
ÈôÊÇ nginx ÈÔÈ»ÎÞ·¨Æô¶¯£¬ÇëʵÑéʹÓÃÒÔÏÂÏÂÁîÇ¿ÖÆÖØмÓÔØÉèÖãº
sudo service nginx -s reread
µÇ¼ºó¸´ÖÆ
6. ÖØÆô nginx
ÈôÊÇÆäËû°ì·¨¶¼ÎÞ·¨½â¾öÎÊÌ⣬ÇëʵÑéÖØÆô nginx£º
sudo service nginx restart
µÇ¼ºó¸´ÖÆ
Õ⽫ÖÕÖ¹²¢ÖØÐÂÆô¶¯ nginx Àú³Ì¡£
7. ÆäËû¹ÊÕÏɨ³ý¼¼ÇÉ
¼ì²é·À»ðǽ¹æÔòÊÇ·ñÔÊÐí nginx ¶Ë¿Ú£¨Í¨³£ÊÇ 80 ºÍ 443£©¡£
È·±£ nginx ÕýÔÚʹÓÃ׼ȷµÄÉèÖÃÎļþ¡£
ʵÑé½ûÓÃÈκεÚÈý·½Ä£¿é»ò²å¼þ¡£
Éó²é nginx ÎĵµÒÔ»ñÈ¡ÓйØÌض¨¹ýʧ»òÎÊÌâµÄ¸ü¶àÐÅÏ¢¡£
ÒÔÉϾÍÊÇnginx¹ÒÁËÔõô°ìµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡