¹¹½¨Çå¾²Îȹ̵ÄÍøÂç¼Ü¹¹£ºNginx Proxy ManagerµÄÓ¦ÓÃÖ®µÀ
¹¹½¨Çå¾²Îȹ̵ÄÍøÂç¼Ü¹¹£ºNginx Proxy ManagerµÄÓ¦ÓÃÖ®µÀ
Ëæ×Å»¥ÁªÍøµÄ¿ìËÙÉú³¤£¬Ô½À´Ô½¶àµÄÍøÕ¾ºÍÓ¦ÓóÌÐòÐèÒª´¦Àí´ó×ÚµÄÍøÂçÇëÇó¡£Í¬Ê±£¬Ëæ×ÅÍøÂç¹¥»÷ÊÖÒÕµÄÒ»Ö±ÌáÉý£¬¹¹½¨Ò»¸öÇå¾²Îȹ̵ÄÍøÂç¼Ü¹¹±äµÃÓÈΪÖ÷Òª¡£ÔÚÕâÑùµÄÅä¾°Ï£¬Nginx Proxy Manager³ÉΪÁËÒ»¸ö±¸ÊܹØ×¢µÄ¹¤¾ß£¬ËüÌṩÁËÇ¿Ê¢µÄÊðÀíºÍ¸ºÔØƽºâ¹¦Ð§£¬Äܹ»×ÊÖúÎÒÃǹ¹½¨Ò»¸öÇå¾²Îȹ̵ÄÍøÂç¼Ü¹¹¡£
Nginx Proxy Manager»ùÓÚNginx¹¹½¨£¬ÊÇÒ»¸ö»ùÓÚWebµÄ½çÃæÖÎÀíÆ÷£¬¿ÉÒÔºÜÊÇÀû±ãµØ¶ÔÊðÀíЧÀÍÆ÷¾ÙÐÐÉèÖúÍÖÎÀí¡£ËüµÄÖ÷Òª¹¦Ð§°üÀ¨·´ÏòÊðÀí¡¢¸ºÔØƽºâ¡¢SSL¼ÓÃܵȣ¬¿ÉÒÔÓÐÓõØÌáÉýÍøÕ¾ºÍÓ¦ÓóÌÐòµÄÐÔÄܺÍÇå¾²ÐÔ¡£
ÔÚʹÓÃNginx Proxy Manager֮ǰ£¬ÎÒÃÇÐèÒªÏÈ×°ÖÃNginxºÍNode.js¡£×°ÖÃÍê³Éºó£¬ÎÒÃÇ¿ÉÒÔͨ¹ýÒÔÏ°취À´ÉèÖúÍʹÓÃNginx Proxy Manager£º
°ì·¨Ò»£º×°ÖúÍÉèÖÃNginx Proxy Manager
Ê×ÏÈ£¬ÎÒÃÇÐèÒªÏÂÔغÍ×°ÖÃNginx Proxy Manager¡£¿ÉÒÔÔÚGitHubÉÏÕÒµ½×îеİ汾£¬ÏÂÔغó½âѹµ½ºÏÊʵÄĿ¼¡£
½ÓÏÂÀ´£¬ÎÒÃÇÐèÒª±à¼ÉèÖÃÎļþconfig.json£¬ÉèÖÃNginx Proxy ManagerµÄһЩ»ù±¾²ÎÊý£¬ºÃ±ÈЧÀÍÆ÷¼àÌýµÄ¶Ë¿Ú¡¢SSLÖ¤ÊéµÄ·¾¶µÈ¡£ÉèÖÃÍê³Éºó£¬ÉúÑÄÎļþ¡£
°ì·¨¶þ£ºÌí¼ÓÊðÀíЧÀÍÆ÷
½øÈëNginx Proxy ManagerµÄÖÎÀí½çÃ棬ÔÚ×ó²àµ¼º½À¸ÖÐÑ¡Ôñ¡°ÊðÀíЧÀÍÆ÷¡±¡£µã»÷¡°Ìí¼Ó¡±°´Å¥£¬ÌîдÊðÀíЧÀÍÆ÷µÄÏà¹ØÐÅÏ¢£¬ºÃ±ÈÃû³Æ¡¢ÓòÃû¡¢ºó¶ËЧÀÍÆ÷µÄIPµØµãºÍ¶Ë¿ÚµÈ¡£µã»÷¡°ÉúÑÄ¡±°´Å¥ºó£¬ÊðÀíЧÀÍÆ÷¾Í»á±»Ìí¼Óµ½ÁбíÖС£
°ì·¨Èý£ºÉèÖ÷´ÏòÊðÀíºÍ¸ºÔØƽºâ
Ñ¡ÖиոÕÌí¼ÓµÄÊðÀíЧÀÍÆ÷£¬µã»÷¡°±à¼¡±°´Å¥£¬½øÈëÊðÀíЧÀÍÆ÷µÄÉèÖýçÃæ¡£ÔÚÕâÀÎÒÃÇ¿ÉÒÔÉèÖ÷´ÏòÊðÀíºÍ¸ºÔØƽºâµÄÏà¹Ø²ÎÊý¡£
Ê×ÏÈ£¬Ñ¡Ôñ¡°·´ÏòÊðÀí¡±Ñ¡Ï£¬ÉèÖ÷´ÏòÊðÀíµÄ·¾¶ºÍÄ¿µÄURL¡£ÀýÈ磬¿ÉÒÔ½«/api·¾¶Ó³Éäµ½http://backend:3000/api¡£
Æä´Î£¬Ñ¡Ôñ¡°¸ºÔØƽºâ¡±Ñ¡Ï£¬ÉèÖøºÔØƽºâµÄÕ½ÂԺͺó¶ËЧÀÍÆ÷ÁÐ±í¡£¿ÉÒÔƾ֤ÏÖÕæÏàÐÎÑ¡ÔñÂÖѯ¡¢IP¹þÏ£¡¢×îСÅþÁ¬ÊýµÈ¸ºÔØƽºâËã·¨¡£
°ì·¨ËÄ£ºÉèÖÃSSL¼ÓÃÜ
ÔÚÊðÀíЧÀÍÆ÷µÄÉèÖýçÃæÖУ¬Ñ¡Ôñ¡°SSL¡±Ñ¡Ï£¬ÉèÖÃSSL¼ÓÃܵÄÏà¹Ø²ÎÊý¡£¿ÉÒÔÑ¡Ôñ×Ô¶¯ÌìÉúÖ¤Ê飬Ҳ¿ÉÒÔÊÖ¶¯ÉÏ´«Ö¤ÊéÎļþ¡£ÉèÖÃÍê³Éºó£¬µã»÷¡°ÉúÑÄ¡±°´Å¥¡£
°ì·¨Î壺ÖØÆôNginxЧÀÍ
ÉèÖÃÍê³Éºó£¬ÎÒÃÇÐèÒªÖØÆôNginxЧÀÍ£¬Ê¹ÉèÖÃÉúЧ¡£¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÀ´ÖØÆôNginxЧÀÍ£º
sudo systemctl restart nginx
µÇ¼ºó¸´ÖÆ
ͨ¹ýÒÔÉÏ°ì·¨£¬ÎÒÃǾÍÀֳɵØÉèÖÃÁËNginx Proxy Manager£¬²¢ÇÒʵÏÖÁË·´ÏòÊðÀí¡¢¸ºÔØƽºâºÍSSL¼ÓÃܹ¦Ð§¡£ÕâÑùÒ»À´£¬ÎÒÃǾͿÉÒԼܹ¹Ò»¸öÇå¾²Îȹ̵ÄÍøÂç¼Ü¹¹£¬ÌáÉýÍøÕ¾ºÍÓ¦ÓóÌÐòµÄÐÔÄܺÍÇå¾²ÐÔ¡£
³ýÁËÉÏÊöµÄ»ù±¾¹¦Ð§Ö®Í⣬Nginx Proxy Manager»¹ÌṩÁËÆäËûһЩ¸ß¼¶¹¦Ð§£¬ºÃ±ÈHTTP/2Ö§³Ö¡¢»º´æѹËõ¡¢ÇëÇóÏÞËٵȡ£ÎÒÃÇ¿ÉÒÔƾ֤ÏÖʵÐèÒª¾ÙÐÐÉèÖúÍʹÓá£
×ܽáÆðÀ´£¬Nginx Proxy ManagerÊÇÒ»¸öºÜÊÇÇ¿Ê¢²¢ÇÒÒ×ÓÚʹÓõŤ¾ß£¬Äܹ»×ÊÖúÎÒÃǹ¹½¨Çå¾²Îȹ̵ÄÍøÂç¼Ü¹¹¡£Í¨¹ýºÏÀíÉèÖúÍʹÓÃNginx Proxy ManagerµÄ¹¦Ð§£¬ÎÒÃÇ¿ÉÒÔÌáÉýÍøÕ¾ºÍÓ¦ÓóÌÐòµÄÐÔÄܺÍÇå¾²ÐÔ£¬ÎªÓû§Ìṩ¸üºÃµÄÌåÑ顣ͬʱ£¬Nginx Proxy Manager»¹¾ßÓи߶ȵÄÎÞаÐԺͿÉÀ©Õ¹ÐÔ£¬¿ÉÒÔƾ֤ÏÖʵÐèÇó¾ÙÐж¨ÖƺÍÀ©Õ¹¡£
Òò´Ë£¬ÎÒÃÇ¿ÉÒÔ¶¨ÐĵØÑ¡ÔñºÍʹÓÃNginx Proxy ManagerÀ´¹¹½¨Çå¾²Îȹ̵ÄÍøÂç¼Ü¹¹£¬ÎªÏÖ´ú»¥ÁªÍøÓ¦ÓÃÌṩ°ü¹Ü¡£ÈÃÎÒÃÇÒ»ÆðʹÓÃNginx Proxy ManagerµÄÇ¿Ê¢¹¦Ð§£¬¹¹½¨¸üºÃµÄÍøÂçÌìÏ£¡
ÒÔÉϾÍÊǹ¹½¨Çå¾²Îȹ̵ÄÍøÂç¼Ü¹¹£ºNginx Proxy ManagerµÄÓ¦ÓÃÖ®µÀµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡