Nginx Proxy ManagerʵÏÖHTTPÇëÇóµÄ»º´æ¼ÓËÙ
Nginx Proxy ManagerÊÇÒ»¸öÓÃÓÚÖÎÀíNginxÊðÀíЧÀÍÆ÷µÄ¹¤¾ß£¬Í¨¹ýʹÓÃËü¿ÉÒÔʵÏÖHTTPÇëÇóµÄ»º´æ¼ÓËÙ¡£ÏÂÃ潫ÏêϸÏÈÈÝÔõÑùʹÓÃNginx Proxy ManagerʵÏÖ»º´æ¼ÓËÙ£¬²¢ÌṩÏêϸµÄ´úÂëʾÀý¡£
Ò»¡¢×°ÖúÍÉèÖÃNginx Proxy Manager
×°ÖÃNginx Proxy Manager£º
$ npm install -g @nginx-plus/nginx-proxy-manager
µÇ¼ºó¸´ÖÆ
Æô¶¯Nginx Proxy Manager£º
$ nginx-proxy-manager start
µÇ¼ºó¸´ÖÆ
½øÈëNginx Proxy ManagerµÄÖÎÀí½çÃ棺
·¿ªä¯ÀÀÆ÷»á¼û http://localhost:81£¬½øÈëNginx Proxy ManagerµÄÖÎÀí½çÃæ¡£
ÉèÖÃNginx Proxy Manager£º
ÔÚÖÎÀí½çÃæÖУ¬Æ¾Ö¤ÌáÐѾÙÐÐNginx Proxy ManagerµÄ³õʼ»¯ÉèÖ㬰üÀ¨ÉèÖÃÖÎÀíÔ±ÕË»§¡¢ÖÎÀíÓòÃûµÈ¡£
¶þ¡¢ÉèÖûº´æ¼ÓËÙ¹æÔò
ÔÚNginx Proxy ManagerµÄÖÎÀí½çÃæÖУ¬Ñ¡ÔñÐèÒª¾ÙÐлº´æ¼ÓËÙµÄÓòÃû£¬µã»÷¡¸Create Rule¡¹½¨ÉèÒ»¸öеĹæÔò¡£
ÔÚ¹æÔòµÄ¡¸Location¡¹×Ö¶ÎÖУ¬ÌîдÐèÒª¾ÙÐлº´æ¼ÓËÙµÄURL¡£
ÔÚ¹æÔòµÄ¡¸Proxy Type¡¹×Ö¶ÎÖУ¬Ñ¡Ôñ¡¸Cache¡¹Ñ¡Ïî¡£
ÔÚ¹æÔòµÄ¡¸Cache Settings¡¹×Ö¶ÎÖУ¬¿ÉÒÔÉèÖûº´æÓâÆÚʱ¼ä¡¢»º´æ¾ÞϸµÈÏà¹Ø²ÎÊý¡£
µã»÷¡¸Save¡¹ÉúÑĹæÔòÉèÖá£
Èý¡¢ÉèÖÃNginx Proxy ManagerµÄNginxЧÀÍÆ÷
ÔÚNginx Proxy ManagerµÄÖÎÀí½çÃæÖУ¬Ñ¡Ôñ¡¸Proxy Hosts¡¹£¬È»ºóµã»÷¡¸Create Proxy Host¡¹½¨ÉèÒ»¸öеÄÊðÀíЧÀÍÆ÷¡£
ÔÚÊðÀíЧÀÍÆ÷µÄ¡¸Domain Names¡¹×Ö¶ÎÖУ¬ÌîдÐèÒª¾ÙÐлº´æ¼ÓËÙµÄÓòÃû¡£
ÔÚÊðÀíЧÀÍÆ÷µÄ¡¸Upstream Servers¡¹×Ö¶ÎÖУ¬ÌîдÏÖʵµÄºó¶ËЧÀÍÆ÷µØµã¡£
µã»÷¡¸Save¡¹ÉúÑÄÊðÀíЧÀÍÆ÷ÉèÖá£
ËÄ¡¢²âÊÔ»º´æ¼ÓËÙЧ¹û
ʹÓÃä¯ÀÀÆ÷»òÕßÏÂÁîÐй¤¾ß·¢ËÍHTTPÇëÇóµ½Nginx Proxy ManagerÉèÖõÄÊðÀíЧÀÍÆ÷ÉÏ¡£
µÚÒ»´ÎÇëÇó»á´Óºó¶ËЧÀÍÆ÷»ñÈ¡Êý¾Ý£¬²¢»º´æµ½NginxЧÀÍÆ÷ÉÏ¡£
Ôٴη¢ËÍÏàͬµÄÇëÇ󣬻áÖ±½Ó´ÓNginxЧÀÍÆ÷µÄ»º´æÖлñÈ¡Êý¾Ý£¬´ó´óÌáÉýÇëÇóÏìÓ¦ËÙÂÊ¡£
´úÂëʾÀý£º
location /example { proxy_pass http://example.com; proxy_cache cache_zone; proxy_cache_key $host$uri$is_args$args; proxy_cache_valid 200 302 12h; proxy_cache_valid 404 1m; proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504; }
µÇ¼ºó¸´ÖÆ
ÒÔÉÏ´úÂëÊÇÒ»¸öNginxµÄÉèÖÃʾÀý£¬ÆäÖÐproxy_cacheÖ¸ÁîÓÃÓÚ¿ªÆô»º´æ¹¦Ð§£¬proxy_cache_keyÖ¸ÁîÓÃÓÚÉèÖûº´æ¼ü£¬proxy_cache_validÖ¸ÁîÓÃÓÚÉèÖûº´æµÄÓÐÓÃʱ¼ä£¬proxy_cache_use_staleÖ¸ÁîÓÃÓÚÉèÖõ±ºó¶ËЧÀÍÆ÷²»¿ÉÓÃʱÊÇ·ñʹÓÃÓâÆڵĻº´æ¡£
ͨ¹ýÒÔÉÏÉèÖÃʾÀý£¬¿ÉÒÔʵÏÖÕë¶Ô/example·¾¶µÄHTTPÇëÇóµÄ»º´æ¼ÓËÙ¹¦Ð§¡£
×ܽ᣺
±¾ÎÄÏÈÈÝÁËÔõÑùʹÓÃNginx Proxy ManagerʵÏÖHTTPÇëÇóµÄ»º´æ¼ÓËÙ£¬²¢¸ø³öÁËÏêϸµÄ×°Öá¢ÉèÖð취ºÍ´úÂëʾÀý¡£Í¨¹ý»º´æ¼ÓËÙ¿ÉÒÔÌá¸ßÍøÕ¾µÄÏìÓ¦ËÙÂÊ£¬¼õÇáºó¶ËЧÀÍÆ÷µÄѹÁ¦£¬¹ØÓڸ߻á¼ûÁ¿µÄÍøÕ¾À´Ëµ¾ßÓÐÖ÷ÒªµÄÒâÒå¡£
ÒÔÉϾÍÊÇNginx Proxy ManagerʵÏÖHTTPÇëÇóµÄ»º´æ¼ÓËÙµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡