×ðÁú¿­Ê±

nginx?errorÈÕÖ¾ÔõôÕûÀí

¹ýʧÈÕ־λÓÚ /var/log/nginx£¨linux£©»ò /usr/local/var/log/nginx£¨macos£© £¬Ê¹ÓÃÏÂÁîÐÐÕûÀí°ì·¨£º1. ±¸·ÝÔ­ÈÕÖ¾ £»2. ½¨Éè¿ÕÎļþ×÷ΪÐÂÈÕÖ¾ £»3. ÖØÆô nginx ЧÀÍ¡£Ò²¿ÉʹÓõÚÈý·½¹¤¾ß£¨Èç logrotate£©»òÉèÖÃ×Ô¶¯ÕûÀí¡£

ÔõÑùÕûÀí Nginx ¹ýʧÈÕÖ¾

Ò»¡¢ÕÒµ½¹ýʧÈÕÖ¾Îļþ

¹ýʧÈÕ־ͨ³£Î»ÓÚÒÔÏ·¾¶£º

/var/log/nginx£¨Linux£©

/usr/local/var/log/nginx£¨macOS£©

¶þ¡¢¼ì²éÎļþ¾Þϸ

¼ì²é¹ýʧÈÕÖ¾ÎļþµÄÄ¿½ñ¾Þϸ £¬ÒÔÈ·¶¨ÊÇ·ñÐèÒªÕûÀí£º

ls -lh /var/log/nginx/error.log

µÇ¼ºó¸´ÖÆ

Èý¡¢Ê¹ÓÃÏÂÁîÐÐÕûÀí

°´ÒÔÏÂ˳ÐòÖ´ÐÐÏÂÁîÕûÀí¹ýʧÈÕÖ¾£º

±¸·ÝÔ­ÓÐÈÕÖ¾Îļþ£º

mv /var/log/nginx/error.log /var/log/nginx/error.log.bak

µÇ¼ºó¸´ÖÆ

½¨ÉèÒ»¸ö¿ÕÎļþ×÷ΪеĹýʧÈÕÖ¾£º

touch /var/log/nginx/error.log

µÇ¼ºó¸´ÖÆ

ÖØÐÂÆô¶¯ Nginx ЧÀÍ£º

nginx -s reload

µÇ¼ºó¸´ÖÆ

ËÄ¡¢Ê¹ÓõÚÈý·½¹¤¾ß

³ýÁËʹÓÃÏÂÁîÐÐ £¬Ä㻹¿ÉÒÔʹÓõÚÈý·½¹¤¾ßÀ´ÕûÀí Nginx ¹ýʧÈÕÖ¾ £¬ÀýÈ磺

logrotate£ºÕâÊÇÒ»¸öÈÕÖ¾ÖÎÀí¹¤¾ß £¬¿ÉÒÔ×Ô¶¯ÕûÀíºÍÂÖ»»ÈÕÖ¾Îļþ¡£

fail2ban£ºÕâÊÇÒ»¸öÈëÇÖ¼ì²âºÍÔ¤·Àϵͳ £¬Ëü¿ÉÒÔ»ùÓÚ¹ýʧÈÕÖ¾ÆÊÎö¿ÉÒÉÔ˶¯²¢×èÖ¹¹¥»÷¡£

Îå¡¢×Ô¶¯ÕûÀí

¹ØÓÚƵÈÔ±¬·¢¹ýʧÈÕÖ¾µÄ¸ßÁ÷Á¿ÍøÕ¾ £¬¿ÉÒÔÉèÖà Nginx ×Ô¶¯ÕûÀí¾ÉµÄ¹ýʧÈÕÖ¾£º

·­¿ª /etc/logrotate.d/nginx ÉèÖÃÎļþ¡£

Ìí¼ÓÒÔÏÂÐУº

/var/log/nginx/*.log {
    rotate 10
    daily
    compress
    delaycompress
    missingok
    notifempty
}

µÇ¼ºó¸´ÖÆ

´ËÉèÖý«±£´æÒÑÍù 10 ÌìµÄ¹ýʧÈÕÖ¾ £¬²¢ÌìÌì×Ô¶¯Ñ¹ËõºÍɾ³ý¾ÉµÄÈÕÖ¾¡£

ÒÔÉϾÍÊÇnginx errorÈÕÖ¾ÔõôÕûÀíµÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±ÊµÊ±ÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
¡¾ÍøÕ¾µØͼ¡¿¡¾sitemap¡¿