ÔõÑùʹÓÃNginx Proxy ManagerʵÏÖ·´ÏòÊðÀíµÄÇëÇó×èµ²Óëת·¢
ÔõÑùʹÓÃNginx Proxy ManagerʵÏÖ·´ÏòÊðÀíµÄÇëÇó×èµ²Óëת·¢
Nginx Proxy ManagerÊÇÒ»¿î»ùÓÚNginxµÄÖÎÀí¹¤¾ß£¬¿ÉÒÔͨ¹ý¼òÆӵĽçÃæÉèÖÃÀ´ÖÎÀíNginx·´ÏòÊðÀí¡£ËüÔÊÐíÓû§Í¨¹ýͼÐνçÃæÉèÖ÷´ÏòÊðÀí¹æÔò£¬Í¬Ê±ÌṩÁËÇëÇó×èµ²Óëת·¢¹¦Ð§£¬ÒÔ±ã¸üºÃµØ¿ØÖÆÇëÇóµÄÁ÷Ïò¡£±¾ÎĽ«ÏÈÈÝÔõÑùʹÓÃNginx Proxy ManagerʵÏÖÇëÇó×èµ²Óëת·¢£¬²¢ÌṩÏêϸµÄ´úÂëʾÀý¡£
×°ÖÃNginx Proxy Manager
Ê×ÏÈ£¬ÎÒÃÇÐèÒªÔÚЧÀÍÆ÷ÉÏ×°ÖÃNginx Proxy Manager¡£Äã¿ÉÒÔ´Ó¹Ù·½ÍøÕ¾£¨https://nginxproxymanager.com/£©ÏÂÔØ×îа汾µÄ×°Öðü£¬²¢Æ¾Ö¤ÆäÖ¸ÄϾÙÐÐ×°Öá£×°ÖÃÍê³Éºó£¬Äã¿ÉÒÔͨ¹ý http://localhost:81 »á¼ûÖÎÀí½çÃ棬ĬÈÏÓû§ÃûºÍÃÜÂëΪadmin¡£
Ìí¼Ó·´ÏòÊðÀíÖ÷»ú
ÔÚNginx Proxy ManagerµÄÖÎÀí½çÃæÖУ¬µã»÷×ó±ßµ¼º½À¸µÄ”Hosts”Ñ¡ÏȻºóµã»÷ÓÒÉϽǵĔAdd Proxy Host”°´Å¥¡£ÔÚµ¯³öµÄ´°¿ÚÖУ¬ÌîдÏà¹ØÐÅÏ¢¡£
ºÃ±È£¬ÄãÒª½«ÇëÇó×èµ²²¢×ª·¢¸øÍâµØµÄ3000¶Ë¿Ú£¬¿ÉÒÔƾ֤ÈçÏÂÉèÖÃÌîд£º
Domain Names: ÊäÈëÄãÒªÊðÀíµÄÓòÃû»òIPµØµã¡£
Scheme: Ñ¡Ôñ”HTTP”»ò”HTTPS”¡£
IP Address/Hostname: ÊäÈëÄãҪת·¢µÄÄ¿µÄµØµã£¬¼´ÍâµØµÄ3000¶Ë¿Ú¡£
Port: ÊäÈëÄãҪת·¢µÄÄ¿µÄ¶Ë¿Ú¡£
µã»÷´°¿Úµ×²¿µÄ”Save”°´Å¥ÉúÑÄÉèÖá£
ÉèÖÃÇëÇó×èµ²Óëת·¢¹æÔò
ÔÚÌí¼ÓÍê·´ÏòÊðÀíÖ÷»úºó£¬ÄãÐèÒªÉèÖÃÇëÇó×èµ²Óëת·¢µÄ¹æÔò¡£µã»÷×ó²àµ¼º½À¸µÄ”Locations”Ñ¡ÏȻºóµã»÷ÓÒÉϽǵĔAdd Location”°´Å¥¡£ÔÚµ¯³öµÄ´°¿ÚÖУ¬ÌîдÏà¹ØÐÅÏ¢¡£
Path: ÊäÈëÄãÒª×èµ²µÄ·¾¶¡£ÀýÈ磬ÄãÒª×èµ²ÒÔ/api¿ªÍ·µÄËùÓÐÇëÇ󣬿ÉÒÔÌîдΪ”/api”¡£
Proxy Host: Ñ¡Ôñ֮ǰÌí¼ÓµÄ·´ÏòÊðÀíÖ÷»ú¡£
Proxy Location: ÊäÈëÄãҪת·¢µÄÄ¿µÄµØµã¡£ÀýÈ磬Ҫת·¢µ½http://localhost:3000£¬ÔòÌîдΪ/¡£
µã»÷´°¿Úµ×²¿µÄ”Save”°´Å¥ÉúÑÄÉèÖá£
ÐÞ¸ÄNginxÉèÖÃÎļþ
ΪÁËʹNginx Proxy ManagerµÄÉèÖÃÉúЧ£¬»¹ÐèÒªÐÞ¸ÄNginxµÄÉèÖÃÎļþ¡£Í¨¹ýSSHµÇ¼µ½ÄãµÄЧÀÍÆ÷£¬²¢ÕÒµ½NginxµÄÉèÖÃÎļþ¡£Æ¾Ö¤ÄãµÄ×°Ö÷½·¨£¬ÉèÖÃÎļþ¿ÉÄÜλÓÚ/etc/nginx/nginx.conf»ò/usr/local/nginx/conf/nginx.conf¡£
ÔÚÉèÖÃÎļþÖÐÕÒµ½ÀàËÆÒÔϵÄλÖÿ飺
http { ... server { ... } }
µÇ¼ºó¸´ÖÆ
ÔÚ¸ÃλÖÿéÖÐÌí¼ÓÈçÏ´úÂ룺
include /var/www/npm/fullchain.pem; include /var/www/npm/privkey.pem; server { listen 80; server_name your_domain.com; location / { proxy_pass http://127.0.0.1:81; proxy_set_header Host $host; } listen 443 ssl; # enable HTTPS ssl_certificate /var/www/npm/fullchain.pem; # provide your SSL certificate ssl_certificate_key /var/www/npm/privkey.pem; # provide your SSL certificate key }
µÇ¼ºó¸´ÖÆ
ÒÔÉÏ´úÂëÖУ¬ÄãÐèÒª½«”/var/www/npm/fullchain.pem”ºÍ”/var/www/npm/privkey.pem”Ì滻ΪÄãµÄSSLÖ¤Êé·¾¶¡£Í¬Ê±£¬½«”your_domain.com”Ì滻ΪÄãµÄÓòÃû¡£
ÉúÑIJ¢Í˳öÎļþ£¬È»ºóÖØмÓÔØNginxÉèÖÃÎļþ£º
sudo nginx -t sudo service nginx restart
µÇ¼ºó¸´ÖÆ
²âÊÔ
ÔÚÍê³ÉÒÔÉÏ°ì·¨ºó£¬Äã¿ÉÒÔÔÚä¯ÀÀÆ÷ÖÐʵÑé»á¼ûÄãµÄÓòÃû£¬²¢ÊÓ²ìÇëÇóÊÇ·ñÀÖ³Éת·¢µ½ÍâµØµÄ3000¶Ë¿Ú¡£Äã¿ÉÒÔ·¿ªä¯ÀÀÆ÷µÄ¿ª·¢Õß¹¤¾ß£¬ÔÚ”Network”±êÇ©ÏÂÉó²éÇëÇóµÄϸ½Ú¡£
ÈôÊÇÒ»ÇÐÉèÖÃ׼ȷ£¬ÇëÇóÓ¦¸Ã»á±»ÀÖ³É×èµ²²¢×ª·¢µ½ÍâµØµÄ3000¶Ë¿Ú£¬È»ºóÔÚä¯ÀÀÆ÷ÖÐÏÔʾÏìÓ¦µÄÄÚÈÝ¡£
×ܽá
±¾ÎÄÏÈÈÝÁËÔõÑùʹÓÃNginx Proxy ManagerʵÏÖÇëÇó×èµ²Óëת·¢£¬²¢ÌṩÁËÏêϸµÄ´úÂëʾÀý¡£Í¨¹ýNginx Proxy ManagerµÄ¼òÆÓÉèÖã¬ÎÒÃÇ¿ÉÒÔÇáËÉʵÏÖ·´ÏòÊðÀíµÄÇëÇóÁ÷Á¿¿ØÖÆ£¬´Ó¶ø¸üºÃµØÖÎÀíЧÀÍÆ÷ÖеÄÇëÇó¡£Ï£Íû±¾ÎÄÄÜ×ÊÖúÄãÃ÷È·ÔõÑùʹÓÃNginx Proxy Manager¾ÙÐÐÇëÇó×èµ²Óëת·¢¡£
ÒÔÉϾÍÊÇÔõÑùʹÓÃNginx Proxy ManagerʵÏÖ·´ÏòÊðÀíµÄÇëÇó×èµ²Óëת·¢µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡