linuxϵͳÉ϶ÔnginxÈÕÖ¾·Ö¸î´¦Àí
NginxÊÇÒ»¸ö·Ç³£ÇáÁ¿µÄWeb·þÎñÆ÷£¬Ìå»ýС¡¢ÐÔÄܸߡ¢ËٶȿìµÈÖî¶àÓŵ㡣µ«²»×ãµÄÊÇÒ²´æÔÚȱµã£¬±ÈÈçnginxµÄÈÕÖ¾ÎļþûÓÐrotate¹¦ÄÜ£¬Æä²úÉúµÄ·ÃÎÊÈÕÖ¾ÎļþÒ»Ö±¾ÍÊÇÒ»¸ö£¬²»»á×Ô¶¯µØ½øÐÐÇиÈç¹û·ÃÎÊÁ¿ºÜ´óµÄ»°£¬½«µ¼ÖÂÈÕÖ¾ÎļþÈÝÁ¿·Ç³£´ó£¬²»±ãÓÚ¹ÜÀí¡£µ±È»ÁË£¬ÎÒÃÇÒ²²»Ï£Íû¿´µ½ÕâôÅÓ´óµÄÒ»¸ö·ÃÎÊÈÕÖ¾Îļþ£¬ÄÇÐèÒªÊÖ¶¯¶ÔÕâ¸öÎļþ½øÐÐÇи
ÔÚLinuxƽ̨ÉÏShell½Å±¾·á¸»£¬ÎÒÃÇ¿ÉÒÔʹÓÃShellдһ¸önginxÈÕÖ¾Çиî½Å±¾£¬ÔÙ¼ÓcrontabÃüÁî×Ô¶¯µØ½øÐÐÇи
ÈÕÖ¾ÎļþÇиîÒªÇó
ÓÉÓÚ Nginx µÄÈÕÖ¾¶¼ÊÇдÔÚÒ»¸öÎļþµ±Öеģ¬Òò´Ë£¬ÎÒÃÇÐèҪÿÌìÁãµã½«Ç°Ò»ÌìµÄÈÕÖ¾´æΪÁíÍâÒ»¸öÎļþ£¬ÕâÀïÎÒÃǾͽ« Nginx λÓÚ logs Ŀ¼ÖÐµÄ access.log ´æΪ access_[yyyyMMdd].log µÄÎļþ¡£Æäʵ logs Ŀ¼Öл¹Óиö error.log µÄ´íÎóÈÕÖ¾Îļþ£¬Õâ¸öÎļþÒ²ÐèҪÿÌìÇиîÒ»¸ö£¬ÔÚÕâÀï¾Í˵ access.log ÁË£¬error.log µÄÇи·¨ÀàËÆ¡£
µÚÒ»²½£ºÖØÃüÃûÈÕÖ¾Îļþ
²»Óõ£ÐÄÖØÃüÃûºónginxÕÒ²»µ½ÈÕÖ¾Îļþ¶ø¶ªÊ§ÈÕÖ¾¡£ÔÚÄãδÖØдò¿ªÔÃû×ÖµÄÈÕÖ¾ÎļþÇ°£¬nginx»¹ÊÇ»áÏòÄãÖØÃüÃûµÄÎļþдÈÕÖ¾£¬linuxÊÇ¿¿ÎļþÃèÊö·û¶ø²»ÊÇÎļþÃû¶¨Î»Îļþ¡£
µÚ¶þ²½£ºÏònginxÖ÷½ø³Ì·¢ËÍUSR1ÐźÅ
nginxÖ÷½ø³Ì½Óµ½Ðźźó»á´ÓÅäÖÃÎļþÖжÁÈ¡ÈÕÖ¾ÎļþÃû³Æ£¬ÖØдò¿ªÈÕÖ¾Îļþ(ÒÔÅäÖÃÎļþÖеÄÈÕÖ¾Ãû³ÆÃüÃû)£¬²¢ÒÔ¹¤×÷½ø³ÌµÄÓû§×÷ΪÈÕÖ¾ÎļþµÄËùÓÐÕß¡£
ÖØдò¿ªÈÕÖ¾Îļþºó£¬nginxÖ÷½ø³Ì»á¹Ø±ÕÖØÃûµÄÈÕÖ¾Îļþ²¢Í¨Öª¹¤×÷½ø³ÌʹÓÃдò¿ªµÄÈÕÖ¾Îļþ¡£
¹¤×÷½ø³ÌÁ¢¿Ì´ò¿ªÐµÄÈÕÖ¾Îļþ²¢¹Ø±ÕÖØÃûÃûµÄÈÕÖ¾Îļþ¡£
È»ºóÄã¾Í¿ÉÒÔ´¦Àí¾ÉµÄÈÕÖ¾ÎļþÁË¡£
nginxÈÕÖ¾°´ÈÕÆÚ×Ô¶¯Çиî½Å±¾ÈçÏ£º
#nginxÈÕÖ¾Çиî½Å±¾ #!/bin/bash #ÉèÖÃÈÕÖ¾Îļþ´æ·ÅĿ¼ logs_path="/data/logs/" #ÉèÖÃpidÎļþ pid_path="/usr/local/nginx/nginx.pid" #ÖØÃüÃûÈÕÖ¾Îļþ mv ${logs_path}access.log ${logs_path}access_$(date -d "yesterday" +"%Y%m%d").log #ÏònginxÖ÷½ø³Ì·¢ÐźÅÖØдò¿ªÈÕÖ¾ kill -USR1 `cat ${pid_path}`±£´æÒÔÉϽű¾nginx_log.sh£¬²¢ÔÚlinuxµÄcrontabÖÐÔö¼ÓÈçÏÂÈÎÎñ£º
0 0 * * * bash /usr/local/nginx/nginx_log.shÕâÑù¾ÍÿÌìµÄ0µã0·Ö°ÑnginxÈÕÖ¾ÖØÃüÃûΪÈÕÆÚ¸ñʽ£¬²¢ÖØÐÂÉú³É½ñÌìµÄÐÂÈÕÖ¾Îļþ¡£
ÍƼöÐÅÏ¢
- linuxÃüÁîѧϰ±Ê¼Ç£¨11£©£ºnlÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨5£©£ºrmÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨4£©£ºmkdirÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨1£©£ºlsÃüÁî
- ½«CentosµÄyumÔ´¸ü»»Îª¹úÄڵİ¢ÀïÔÆÔ´
- ʹÓÃNginxÌí¼Óheader·ÀÖ¹ÍøÒ³±»frame
- linuxϼÓËÙscp´«Êä´óÎļþµÄËÙ¶È
- linuxϵͳÉ϶ÔnginxÈÕÖ¾·Ö¸î´¦Àí
- lnmp/nginxϵͳÕæÕýÓÐЧµÄͼƬ·ÀµÁÁ´ÍêÕûÉèÖÃÏê½â
- Í»ÆÆÊ®Íò²¢·¢µÄNginxµÄÅäÖü°ÓÅ»¯
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- ²éÕÒ²¢É¾³ý.svnĿ¼Îļþ
- redis ÆßÖÖÊý¾ÝÀàÐ͵ÄʹÓó¡¾°
- linux ÏÂÎļþ¸´ÖƵ½windowsÏÂÂÒÂëµÄ½â¾ö°ì·¨
- nginx³öÏÖ502 upstream sent too big he....
- linuxÏÂsudoÅäÖÃÏê½â
- linuxÃüÁîѧϰ±Ê¼Ç£¨15£©£ºtailÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨14£©£ºheadÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨13£©£ºlessÃüÁî
- linuxÃüÁîѧϰ±Ê¼Ç£¨12£©£ºmoreÃüÁî
- ¼ÓÃÜËã·¨±È½Ï3DES AES RSA ECC MD5 SHA1µÈ
ÆÀÂÛ