Nginx Proxy ManagerÓëÈÝÆ÷ÍøÂçµÄÓÅ»¯ÓëÀ©Õ¹
Nginx Proxy ManagerÓëÈÝÆ÷ÍøÂçµÄÓÅ»¯ÓëÀ©Õ¹
СÐò£º
Ëæ×ÅÈÝÆ÷ÊÖÒÕµÄÐËÆð£¬Ô½À´Ô½¶àµÄÓ¦ÓóÌÐò×îÏȽÓÄÉÈÝÆ÷»¯µÄ·½·¨¾ÙÐа²ÅźÍÖÎÀí¡£ÔÚÈÝÆ÷ÍøÂçÖУ¬ÔõÑùÓÅ»¯ºÍÀ©Õ¹Ó¦ÓóÌÐòµÄÍøÂç»á¼û³ÉΪһ¸öÖ÷ÒªµÄÎÊÌâ¡£±¾ÎĽ«ÏÈÈÝÔõÑùͨ¹ýNginx Proxy ManagerÀ´ÊµÏÖÈÝÆ÷ÍøÂçµÄÓÅ»¯ºÍÀ©Õ¹£¬²¢ÌṩÏêϸµÄ´úÂëʾÀý¡£
Ò»¡¢Nginx Proxy Manager¼ò½é
Nginx Proxy ManagerÊÇÒ»¸ö»ùÓÚNginxµÄ·´ÏòÊðÀí¹¤¾ß£¬ËüÄܹ»×ÊÖúÎÒÃÇÖÎÀíºÍÉèÖöà¸öÓ¦ÓóÌÐòµÄÍøÂçÇëÇó¡£Í¨¹ýNginx Proxy Manager£¬ÎÒÃÇ¿ÉÒÔʵÏÖÁ÷Á¿µÄ¸ºÔØƽºâ¡¢HTTPSÖ§³Ö¡¢ÐéÄâÖ÷»úÉèÖõȹ¦Ð§£¬´Ó¶øÌá¸ßÓ¦ÓóÌÐòµÄÐÔÄܺͿɿ¿ÐÔ¡£
¶þ¡¢ÈÝÆ÷ÍøÂçµÄÓÅ»¯
ÔÚÈÝÆ÷ÍøÂçÖУ¬Ó¦ÓóÌÐòͨ³£ÊÇÒÔÈÝÆ÷µÄÐÎʽ°²ÅŲ¢ÔËÐеġ£Ã¿¸öÈÝÆ÷¶¼ÓÐ×Ô¼ºµÄIPµØµãºÍ¶Ë¿ÚºÅ£¬²¢ÇÒÈÝÆ÷Ö®¼äµÄÍøÂçÊÇͨ¹ýdocker bridgeÍøÂç¾ÙÐÐÅþÁ¬µÄ¡£ÔÚÕâÖÖÇéÐÎÏ£¬ÎÒÃÇ¿ÉÒÔͨ¹ýNginx Proxy ManagerÀ´ÓÅ»¯ÈÝÆ÷ÍøÂçµÄ»á¼û¡£
¸ºÔØƽºâ
ÔÚÈÝÆ÷ÍøÂçÖУ¬¿ÉÄÜ»áÓжà¸öÏàͬÀàÐ͵ÄÈÝÆ÷ÔËÐÐͳһ¸öÓ¦ÓóÌÐò¡£ÎªÁËÌá¸ßÓ¦ÓóÌÐòµÄÐÔÄܺͿɿ¿ÐÔ£¬ÎÒÃÇ¿ÉÒÔʹÓÃNginx Proxy ManagerʵÏÖ¸ºÔØƽºâ¡£Ïêϸ´úÂëʾÀýÈçÏ£º
server { listen 80; server_name example.com; location / { proxy_pass http://backend; proxy_set_header Host $host; } } upstream backend { server container1:port; server container2:port; server container3:port; }
µÇ¼ºó¸´ÖÆ
ÉÏÊö´úÂëÖУ¬Nginx Proxy Manager»á½«ÇëÇó·Ö·¢µ½¶à¸öÈÝÆ÷ÉϾÙÐд¦Àí£¬´Ó¶øÌá¸ßÓ¦ÓóÌÐòµÄ²¢·¢´¦ÀíÄÜÁ¦¡£
HTTPSÖ§³Ö
ÔÚÈÝÆ÷ÍøÂçÖУ¬ÎªÁË°ü¹ÜÊý¾Ý´«ÊäµÄÇå¾²ÐÔ£¬Í¨³£ÐèҪʹÓÃHTTPSÐÒé¾ÙÐмÓÃÜ´«Ê䡣ͨ¹ýNginx Proxy Manager£¬ÎÒÃÇ¿ÉÒÔÇáËɵØʵÏÖHTTPSÖ§³Ö¡£Ïêϸ´úÂëʾÀýÈçÏ£º
server { listen 443 ssl; server_name example.com; ssl_certificate /path/to/certificate.crt; ssl_certificate_key /path/to/private.key; location / { proxy_pass http://backend; proxy_set_header Host $host; } } upstream backend { server container1:port; server container2:port; server container3:port; }
µÇ¼ºó¸´ÖÆ
ÉÏÊö´úÂëÖУ¬Nginx Proxy Manager»áʹÓÃSSLÖ¤Êé¶Ô´«ÊäÊý¾Ý¾ÙÐмÓÃÜ£¬°ü¹ÜÊý¾ÝµÄÇå¾²ÐÔ¡£
Èý¡¢ÈÝÆ÷ÍøÂçµÄÀ©Õ¹
³ýÁËÓÅ»¯ÈÝÆ÷ÍøÂçµÄ»á¼û£¬Nginx Proxy Manager»¹¿ÉÒÔ×ÊÖúÎÒÃÇÀ©Õ¹ÈÝÆ÷ÍøÂçµÄ¹æÄ£¡£ÔÚÈÝÆ÷ÍøÂçÖУ¬¿ÉÄܻᱣ´æ¶à¸öÈÝÆ÷ÔËÐвî±ðµÄÓ¦ÓóÌÐò£¬Í¨¹ýNginx Proxy Manager£¬ÎÒÃÇ¿ÉÒÔÇáËɵØʵÏÖ¶à¸öÓ¦ÓóÌÐòµÄÖÎÀíºÍ»á¼û¿ØÖÆ¡£
ÐéÄâÖ÷»úÉèÖÃ
ÔÚÈÝÆ÷ÍøÂçÖУ¬Ã¿¸öÓ¦ÓóÌÐòͨ³£¶¼ÓÐ×Ô¼ºµÄÓòÃû¡£Í¨¹ýNginx Proxy Manager£¬ÎÒÃÇ¿ÉÒÔʹÓÃÐéÄâÖ÷»úÉèÖÃÀ´ÖÎÀí¶à¸öÓ¦ÓóÌÐòµÄÓòÃû»á¼û¡£Ïêϸ´úÂëʾÀýÈçÏ£º
server { listen 80; server_name app1.example.com; location / { proxy_pass http://container1:port; proxy_set_header Host $host; } } server { listen 80; server_name app2.example.com; location / { proxy_pass http://container2:port; proxy_set_header Host $host; } }
µÇ¼ºó¸´ÖÆ
ÉÏÊö´úÂëÖУ¬Nginx Proxy Manager½«Æ¾Ö¤»á¼ûµÄÓòÃûÀ´½«ÇëÇóת·¢µ½ÏìÓ¦µÄÈÝÆ÷ÉϾÙÐд¦Àí£¬ÊµÏÖ¶à¸öÓ¦ÓóÌÐòµÄ»á¼û¿ØÖÆ¡£
URLÖض¨Ïò
ÔÚÈÝÆ÷ÍøÂçÖУ¬ÎÒÃÇ¿ÉÄÜ»áÏ£Íû½«Ä³¸öURLµÄÇëÇóÖض¨Ïòµ½ÁíÒ»¸öURLÉÏ¡£Í¨¹ýNginx Proxy Manager£¬ÎÒÃÇ¿ÉÒÔÇáËɵØʵÏÖURLµÄÖض¨Ïò¡£Ïêϸ´úÂëʾÀýÈçÏ£º
server { listen 80; server_name example.com; location /old-url { rewrite ^/old-url(.*)$ /new-url$1 permanent; } location / { proxy_pass http://backend; proxy_set_header Host $host; } } upstream backend { server container:port; }
µÇ¼ºó¸´ÖÆ
ÉÏÊö´úÂëÖУ¬Nginx Proxy Manager½«½«¶Ô/old-urlµÄÇëÇóÖض¨Ïòµ½/new-urlÉϾÙÐд¦Àí¡£
½áÂÛ£º
ͨ¹ýNginx Proxy Manager£¬ÎÒÃÇ¿ÉÒÔÓÅ»¯ºÍÀ©Õ¹ÈÝÆ÷ÍøÂçµÄ»á¼û¡£Í¨¹ý¸ºÔØƽºâ¡¢HTTPSÖ§³Ö¡¢ÐéÄâÖ÷»úÉèÖúÍURLÖض¨ÏòµÈ¹¦Ð§£¬ÎÒÃÇ¿ÉÒÔÌá¸ßÓ¦ÓóÌÐòµÄÐÔÄܺͿɿ¿ÐÔ£¬Í¬Ê±Ò²Äܹ»Àû±ãµØÖÎÀíºÍÀ©Õ¹ÈÝÆ÷ÍøÂç¡£
ÒÔÉϾÍÊÇNginx Proxy ManagerÓëÈÝÆ÷ÍøÂçµÄÓÅ»¯ÓëÀ©Õ¹µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡