×ðÁú¿­Ê±

nginx»º´æÔõôÕûÀí

ʹÓà purge Ö¸Áîɾ³ýÌض¨ url ģʽµÄ»º´æÎļþ¡£Ê¹Óà lua ¾ç±¾Æ¾Ö¤Ìõ¼þɾ³ý»º´æÎļþ¡£ÖØмÓÔØ nginx ÉèÖÃɨ³ýËùÓлº´æÎļþ¡£Ê¹Óà nginx nagios ²å¼þͨ¹ý url ģʽɨ³ý»º´æÎļþ¡£ÊÖ¶¯É¾³ý /var/cache/nginx Ŀ¼ÖеĻº´æÎļþ¡£

ÔõÑùÕûÀí Nginx »º´æ

Nginx£¬×÷ΪһÖÖÊ¢ÐÐµÄ Web ЧÀÍÆ÷£¬¾ßÓлº´æ¹¦Ð§£¬¿ÉÒÔÌáÉýÍøÕ¾ÏìÓ¦ËÙÂʲ¢ïÔ̭ЧÀÍÆ÷¸ºÔØ¡£È»¶ø£¬Ëæ×Å»º´æÊý¾ÝÒ»Ö±ÀÛ»ý£¬ËüÓÐʱÐèÒªÕûÀíÒÔÈ·±£¸ßЧÔËÐС£ÒÔÏÂÊÇÓÐÖúÓÚÕûÀí Nginx »º´æµÄÒªÁ죺

1. ʹÓà purge Ö¸Áî

purge Ö¸Áî¿ÉÓÃÓÚɾ³ýÆ¥ÅäÖ¸¶¨ URL ģʽµÄ»º´æÎļþ¡£ÒªÊ¹ÓôËÖ¸ÁÇë±à¼­ Nginx ÉèÖÃÎļþ£¨Í¨³£ÊÇ /etc/nginx/nginx.conf£©²¢ÔÚ http {} ¿éÖÐÌí¼ÓÒÔÏÂÐУº

location /purge {
    valid_methods PURGE;
    purge /file_to_delete$;
}

µÇ¼ºó¸´ÖÆ

ÆäÖÐ /file_to_delete$ ÊÇҪɾ³ýµÄ»º´æÎļþµÄ·¾¶¡£

2. ʹÓà Lua ¾ç±¾

Lua ¾ç±¾ÌṩÁ˸üÎÞаµÄ»º´æÕûÀíÑ¡Ïî¡£¿ÉÒÔ±àд½ÅÔ­À´Æ¾Ö¤Ìض¨Ìõ¼þ£¨ÈçÎļþÐÞ¸Äʱ¼ä»òÇëÇóƵÂÊ£©É¾³ý»º´æÎļþ¡£ÓйØÏêϸÐÅÏ¢£¬Çë²ÎÔÄ Nginx ¹Ù·½ÎĵµÖÐµÄ Purge with Lua¡£

3. ÖØмÓÔØ Nginx ÉèÖÃ

ÖØмÓÔØ Nginx ÉèÖûᵼÖÂËùÓлº´æÎļþ±»É¾³ý¡£ÕâÊÇÒ»ÖÖ¼òÆÓ´Ö±©µÄÒªÁ죬µ«¿ÉÒÔÓÐÓÃɨ³ý»º´æ¡£ÒªÔÚ Linux ϵͳÉÏÖØмÓÔØÉèÖã¬ÇëÔËÐÐÒÔÏÂÏÂÁ

sudo systemctl reload nginx

µÇ¼ºó¸´ÖÆ

4. ʹÓà Nginx Nagios ²å¼þ

¹ØÓÚ¼à¿ØºÍÖÎÀí Nginx »º´æ£¬Nginx Nagios ²å¼þÌṩÁËһϵÁÐÓÐÓõÄÏÂÁî¡£ÆäÖаüÀ¨ purge ÏÂÁËüÔÊÐíÄúͨ¹ýת´ï URL ģʽÀ´É¨³ý»º´æÎļþ¡£Çë²ÎÔIJå¼þÎĵµÒÔ»ñÈ¡¸ü¶àÐÅÏ¢¡£

5. ÊÖ¶¯É¾³ý»º´æÎļþ

Nginx »º´æÎļþͨ³£´æ´¢ÔÚ /var/cache/nginx Ŀ¼ÖС£Äú¿ÉÒÔÊÖ¶¯ä¯ÀÀ¸ÃĿ¼²¢É¾³ýËùÐèµÄÎļþ¡£¿ÉÊÇ£¬Çë×¢ÖØÐÞ¸ÄЧÀÍÆ÷Îļþϵͳ¿ÉÄÜ»á´øÀ´Î£º¦¡£

Ò»µ©Ñ¡ÔñÁËËùÐèµÄÒªÁ죬¾Í¿ÉÒÔƾ֤ÐèÒªÕûÀí Nginx »º´æ¡£°´ÆÚÕûÀí»º´æ¿ÉÒÔ¼á³Ö Nginx µÄ¸ßЧÔËÐУ¬²¢È·±£»º´æʼÖÕ°üÀ¨×îÐÂÊý¾Ý¡£

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

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

Ïà¹ØÐÂÎÅ

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

13452372176

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

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

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