×ðÁú¿­Ê±¹ÙÍøµÇ¼

ÔõÑùʹÓÃNginx Proxy ManagerʵÏÖ¿ìËÙ»º´æHTMLÒ³Ãæ

ÔõÑùʹÓÃNginx Proxy ManagerʵÏÖ¿ìËÙ»º´æHTMLÒ³Ãæ

СÐò£º

ÔÚÏÖ´úÍøÂçÓ¦ÓÃÖÐ £¬¿ìËÙ¼ÓÔØÍøÒ³ÊÇÒ»¸öÖ÷ÒªµÄÐèÇó¡£ÎªÁËÌá¸ßÓû§ÌåÑé £¬ÎÒÃÇ¿ÉÒÔʹÓÃNginx Proxy ManagerÀ´ÊµÏÖ¿ìËÙ»º´æHTMLÒ³Ãæ¡£±¾ÎĽ«ÏòÄúչʾÔõÑùʹÓÃNginx Proxy ManagerÀ´ÊµÏÖÕâһĿµÄ £¬²¢ÌṩÏêϸµÄ´úÂëʾÀý¡£

µÚÒ»²¿·Ö£º×°ÖÃÓëÉèÖÃNginx Proxy Manager

×°ÖÃNginx Proxy Manager

Ê×ÏÈ £¬ÎÒÃÇÐèҪƾ֤¹Ù·½ÎĵµµÄָʾ £¬×°ÖÃNginx Proxy Manager¡£Äú¿ÉÒÔ´Ó¹Ù·½ÍøÕ¾ÉÏÕÒµ½ÊʺÏÄú²Ù×÷ϵͳµÄ×°Öðü £¬²¢Æ¾Ìý˵Ã÷¾ÙÐÐ×°Öá£

ÉèÖÃNginx Proxy Manager

·­¿ªNginx Proxy ManagerµÄÉèÖÃÎļþ £¬Æ¾Ö¤ÄúµÄÐèÇó¾ÙÐÐÏìÓ¦µÄÉèÖá£Äú¿ÉÒÔÉèÖûº´æ¾Þϸ¡¢»º´æ·¾¶µÈ²ÎÊý £¬ÒÔÖª×ãÄúµÄÏêϸÐèÇó¡£Ò»¸öʾÀýµÄÉèÖÃƬ¶ÏÈçÏÂËùʾ£º

Á¬Ã¦Ñ§Ï°¡°Ç°¶ËÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡± £»

proxy_cache_path /path/to/cache levels=1:2 keys_zone=my_cache:10m max_size=10g inactive=60m use_temp_path=off;

µÇ¼ºó¸´ÖÆ

ÔÚÉÏÃæµÄʾÀýÖÐ £¬ÎÒÃÇÉèÖÃÁËÒ»¸öÃûΪ”my_cache”µÄ»º´æ·¾¶ £¬×î´ó»º´æ¾ÞϸΪ10GB £¬»º´æʱ¼äΪ60·ÖÖÓ¡£

µÚ¶þ²¿·Ö£ºÉèÖÃNginx·´ÏòÊðÀí

ÉèÖÃNginx·´ÏòÊðÀí

ÔÚNginx Proxy ManagerµÄÉèÖÃÎļþÖÐ £¬ÎÒÃÇÐèÒªÉèÖ÷´ÏòÊðÀíÀ´»º´æHTMLÒ³Ãæ¡£Ò»¸öʾÀýµÄÉèÖÃƬ¶ÏÈçÏÂËùʾ£º

server {
    listen 80;
    server_name example.com;

    location / {
        proxy_pass http://backend_server;
        proxy_cache my_cache;
        proxy_cache_valid 200 5m;
        proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
        proxy_cache_revalidate on;
        proxy_cache_lock on;
    }
}

µÇ¼ºó¸´ÖÆ

ÔÚÉÏÃæµÄʾÀýÖÐ £¬ÎÒÃÇÉèÖÃÁËÒ»¸ö¼àÌý80¶Ë¿ÚµÄserver £¬²¢½«ËùÓÐÇëÇóͨ¹ý·´ÏòÊðÀí£¨proxy_pass£©×ª·¢µ½ÃûΪ”backend_server”µÄºó¶ËЧÀÍÆ÷¡£ÎÒÃÇ»¹ÉèÖÃÁË»º´æÃûΪ”my_cache” £¬²¢ÉèÖÃÁËÒ»¸öÓÐÓÃÆÚΪ5·ÖÖӵĻº´æÕ½ÂÔ¡£

ÖØÆôNginx Proxy Manager

µ±Nginx Proxy ManagerµÄÉèÖÃÍê³Éºó £¬ÎÒÃÇÐèÒªÖØÆôNginx Proxy ManagerÒÔʹÉèÖÃÉúЧ¡£Äú¿ÉÒÔÔËÐÐÒÔÏÂÏÂÁîÀ´ÖØÆô£º

sudo systemctl restart nginx

µÇ¼ºó¸´ÖÆ

µÚÈý²¿·Ö£º²âÊÔ»º´æЧ¹û

»á¼ûÍøÒ³

ÏÖÔÚ £¬Äú¿ÉÒÔͨ¹ýä¯ÀÀÆ÷»á¼ûÄúµÄÍøÕ¾ £¬Õý³£¼ÓÔØÄúµÄHTMLÒ³Ãæ¡£

¼ì²é»º´æ

µ±ÄúµÄÍøÒ³±»Ê״λá¼ûºó £¬Äú¿ÉÒÔͨ¹ýÉó²é»º´æ·¾¶ÖеÄÎļþÀ´È·ÈÏÍøÒ³ÊÇ·ñ±»»º´æ¡£ÀýÈç £¬ÈôÊÇÎÒÃǽ«»º´æ·¾¶ÉèÖÃΪ”/path/to/cache” £¬Äú¿ÉÒÔÔËÐÐÒÔÏÂÏÂÁîÀ´Éó²é»º´æÎļþ£º

ls /path/to/cache

µÇ¼ºó¸´ÖÆ

ÈôÊÇÄú¿´µ½ÀàËÆÓÚ”example.com/index.html”µÄÎļþ £¬ÄÇôÌåÏÖÄúµÄÍøÒ³ÒѾ­±»Àֳɻº´æ¡£

²âÊÔ»º´æЧ¹û

ÏÖÔÚ £¬¹Ø±Õä¯ÀÀÆ÷²¢Ôٴλá¼ûÄúµÄÍøÒ³¡£Äú»á·¢Ã÷ÍøÒ³¼ÓÔØËÙÂʸü¿ì £¬ÕâÊÇÓÉÓÚNginx Proxy Manager»áÖ±½Ó´Ó»º´æÖзµ»ØÍøÒ³ £¬¶ø²»ÊÇÏòºó¶ËЧÀÍÆ÷ÇëÇó¡£

½áÂÛ£º

ͨ¹ýʹÓÃNginx Proxy Manager £¬ÎÒÃÇ¿ÉÒÔÇáËɵØʵÏÖ¿ìËÙ»º´æHTMLÒ³Ãæ¡£±¾ÎÄÌṩÁË×°Öá¢ÉèÖúͲâÊÔµÄÏêϸ°ì·¨ £¬²¢ÌṩÁËÏêϸµÄ´úÂëʾÀý £¬×ÊÖúÄú¿ìËÙ×îÏÈʵÏÖÕâһĿµÄ¡£Çëƾ֤ÄúµÄÏêϸÐèÇó¶ÔʾÀý´úÂë¾ÙÐе÷½â £¬²¢Æ¾Ö¤¹Ù·½Îĵµ¾ÙÐиü¶àµÄÉèÖúÍÓÅ»¯¡£×£ÄúÀÖ³ÉʵÏÖ¿ìËÙ»º´æHTMLÒ³Ã棡

ÒÔÉϾÍÊÇÔõÑùʹÓÃNginx Proxy ManagerʵÏÖ¿ìËÙ»º´æHTMLÒ³ÃæµÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

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

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

QR code
ÍøÕ¾µØͼ