Nginx Proxy ManagerÓëSSLÖ¤ÊéµÄʹÓ㺰ü¹ÜÍøÕ¾Çå¾²
Nginx Proxy ManagerÓëSSLÖ¤ÊéµÄʹÓ㺰ü¹ÜÍøÕ¾Çå¾²£¬ÐèÒªÏêϸ´úÂëʾÀý
ÕªÒª£º±¾ÎÄÖ¼ÔÚÏÈÈÝNginx Proxy ManagerÓëSSLÖ¤ÊéµÄʹÓã¬ÒÔ°ü¹ÜÍøÕ¾µÄÇå¾²ÐÔ¡£ÎÄÕ½«ÏÈÈÝNginx Proxy ManagerµÄ»ù±¾¿´·¨ºÍ¹¦Ð§£¬²¢Í¨¹ýÏêϸµÄ´úÂëʾÀýÀ´Õ¹Ê¾ÔõÑùÉèÖÃSSLÖ¤ÊéÒÔÈ·±£ÍøÕ¾µÄÇå¾²ÐÔ¡£
СÐò
ÏÖ´ú»¥ÁªÍøÇéÐÎÖУ¬ÍøÕ¾µÄÇå¾²ÐÔÖÁ¹ØÖ÷Òª¡£¶øSSLÖ¤Êé×÷ΪһÖÖ¼ÓÃÜͨѶµÄ·½·¨£¬ÒѾ³ÉΪÁË°ü¹ÜÍøÕ¾Çå¾²µÄ±ê×¼ÊÖ¶ÎÖ®Ò»¡£¶øNginx Proxy ManagerÊÇÒ»¿î»ùÓÚNginxµÄÊðÀíÖÎÀí¹¤¾ß£¬ËüÌṩÁËÀû±ãµÄ½çÃæÀ´ÉèÖúÍÖÎÀíWebЧÀÍÆ÷ºÍ·´ÏòÊðÀí¡£
Nginx Proxy Manager¼ò½é
Nginx Proxy ManagerÊÇÒ»¸ö»ùÓÚNginxµÄ·´ÏòÊðÀíÖÎÀí¹¤¾ß£¬ËüÌṩÁËÒ»¸öÒ×ÓÚʹÓõÄweb½çÃ棬ÓÃÓÚÖÎÀíÐéÄâÖ÷»ú¡¢·´ÏòÊðÀí¡¢SSLÖ¤ÊéºÍ»á¼û¿ØÖƵȹ¦Ð§¡£
ͨ¹ýNginx Proxy Manager£¬ÎÒÃÇ¿ÉÒÔ½¨Éè¶à¸öÐéÄâÖ÷»ú£¬²¢½«ÕâЩÖ÷»ú·ÖÅɸø²î±ðµÄÓòÃû¡£Í¬Ê±£¬ÎÒÃÇ¿ÉÒÔΪÿ¸öÐéÄâÖ÷»úÉèÖ÷´ÏòÊðÀí¹æÔò£¬Î´À´×Ô²î±ðÓòÃûµÄÇëÇóת·¢µ½²î±ðµÄºó¶ËЧÀÍÆ÷¡£±ðµÄ£¬Nginx Proxy Manager»¹Ö§³ÖSSLÖ¤ÊéµÄÖÎÀíºÍÉèÖã¬ÒÔ¼ÓÃÜÍøÕ¾µÄͨѶ¡£
×°ÖúÍÆô¶¯Nginx Proxy Manager
Ê×ÏÈ£¬ÎÒÃÇÐèҪװÖÃNginx Proxy Manager¡£¿ÉÒÔͨ¹ýÒÔÏ°취À´Íê³É£º
°ì·¨1£º×°ÖÃDocker
sudo apt-get update sudo apt-get install docker.io
µÇ¼ºó¸´ÖÆ
°ì·¨2£ºÆô¶¯Nginx Proxy ManagerÈÝÆ÷
sudo docker run -d -p 80:80 -p 81:81 -p 443:443 --name nginx-proxy-manager -v ~/nginx-proxy-manager:/data --restart always jlesage/nginx-proxy-manager
µÇ¼ºó¸´ÖÆ
ÕâÑù£¬Nginx Proxy Manager¾ÍÀÖ³É×°Öò¢Æô¶¯ÁË¡£ÎÒÃÇ¿ÉÒÔͨ¹ýä¯ÀÀÆ÷»á¼ûhttp://localhost:81À´·¿ªNginx Proxy ManagerµÄWeb½çÃæ¡£
ÉèÖÃSSLÖ¤Êé
½ÓÏÂÀ´£¬ÎÒÃÇÐèÒªÉèÖÃSSLÖ¤ÊéÒÔÈ·±£ÍøÕ¾µÄÇå¾²ÐÔ¡£Ê×ÏÈ£¬ÎÒÃÇÐèÒª»ñÈ¡SSLÖ¤Ê飬¿ÉÒÔͨ¹ýÒÔÏ°취À´Íê³É£º
°ì·¨1£º·¿ªNginx Proxy ManagerµÄWeb½çÃ棬²¢µÇ¼¡£
°ì·¨2£ºµã»÷×ó²àµ¼º½À¸Öеġ°SSLÖ¤Ê顱ѡÏî¡£
°ì·¨3£ºµã»÷ÓÒÉϽǵġ°+¡±°´Å¥£¬½øÈëSSLÖ¤ÊéÉèÖÃÒ³Ãæ¡£
°ì·¨4£ºÔÚ¡°ÓòÃû¡±×Ö¶ÎÖÐÊäÈëÄãµÄÓòÃû£¬²¢µã»÷¡°ÉúÑÄ¡±°´Å¥¡£
ÕâÑù£¬Nginx Proxy Manager»á×Ô¶¯×ÊÖúÎÒÃÇ»ñÈ¡²¢ÉèÖÃSSLÖ¤Êé¡£
ÉèÖ÷´ÏòÊðÀí
½ÓÏÂÀ´£¬ÎÒÃÇÐèҪΪÐéÄâÖ÷»úÉèÖ÷´ÏòÊðÀí¹æÔò£¬Î´À´×Ô²î±ðÓòÃûµÄÇëÇóת·¢µ½²î±ðµÄºó¶ËЧÀÍÆ÷¡£ÒÔÏÂÊÇÒ»¸öʾÀýµÄ·´ÏòÊðÀíÉèÖãº
location / { proxy_pass http://backend_server; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }
µÇ¼ºó¸´ÖÆ
½«ÉÏÊö´úÂëÖеÄbackend_serverÌ滻ΪÄúµÄºó¶ËЧÀÍÆ÷µØµã¡£
ÉèÖûá¼û¿ØÖÆ
ΪÁËÔöÌíÍøÕ¾µÄÇå¾²ÐÔ£¬ÎÒÃÇ»¹¿ÉÒÔÉèÖûá¼û¿ØÖÆÒÔÏÞÖƶÔÐéÄâÖ÷»úµÄ»á¼û¡£ÒÔÏÂÊÇÒ»¸öʾÀýµÄ»á¼û¿ØÖÆÉèÖãº
location / { allow IP1; allow IP2; deny all; # other configurations... }
µÇ¼ºó¸´ÖÆ
½«ÉÏÊö´úÂëÖеÄIP1ºÍIP2Ì滻ΪÄúÔÊÐí»á¼ûµÄIPµØµã¡£
½áÂÛ
±¾ÎÄÏÈÈÝÁËNginx Proxy ManagerÓëSSLÖ¤ÊéµÄʹÓã¬ÒÔ°ü¹ÜÍøÕ¾µÄÇå¾²ÐÔ¡£Í¨¹ýNginx Proxy Manager£¬ÎÒÃÇ¿ÉÒÔÀû±ãµØÉèÖ÷´ÏòÊðÀíºÍSSLÖ¤Ê顣ͬʱ£¬Í¨¹ýÏêϸµÄ´úÂëʾÀý£¬ÎÒÃÇչʾÁËÔõÑùÉèÖÃSSLÖ¤ÊéÒÔ¼°ÔõÑùÉèÖ÷´ÏòÊðÀíºÍ»á¼û¿ØÖÆ¡£Ï£Íû±¾ÎĶÔÄúÃ÷È·ºÍÓ¦ÓÃNginx Proxy ManagerÓÐËù×ÊÖú¡£
ÒÔÉϾÍÊÇNginx Proxy ManagerÓëSSLÖ¤ÊéµÄʹÓ㺰ü¹ÜÍøÕ¾Çå¾²µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡