ʹÓÃNginx Proxy ManagerʵÏÖ»ùÓÚÓû§µÄ»á¼û¿ØÖÆÕ½ÂÔ
ʹÓÃNginx Proxy ManagerʵÏÖ»ùÓÚÓû§µÄ»á¼û¿ØÖÆÕ½ÂÔ
Nginx Proxy ManagerÊÇÒ»¿îÇ¿Ê¢µÄÊðÀíЧÀÍÆ÷ÖÎÀí¹¤¾ß£¬Ëü»ùÓÚNginxʵÏÖÁ˼òÆÓÒ×ÓõÄͼÐλ¯½çÃ棬¿ÉÒÔ×ÊÖúÎÒÃÇÇáËɵØÖÎÀíÊðÀíЧÀÍ¡£ÔÚÏÖʵӦÓÃÖУ¬ÎÒÃǾ³£ÐèÒª¶Ô²î±ðµÄÓû§¾ÙÐлá¼û¿ØÖÆ£¬ÒÔ±£»¤Ãô¸ÐµÄÐÅÏ¢ºÍ×ÊÔ´¡£±¾ÎĽ«ÏêϸÏÈÈÝÔõÑùʹÓÃNginx Proxy ManagerʵÏÖ»ùÓÚÓû§µÄ»á¼û¿ØÖÆÕ½ÂÔ£¬²¢¸ø³öÏêϸµÄ´úÂëʾÀý¡£
Ê×ÏÈ£¬ÎÒÃÇÐèҪװÖò¢ÉèÖÃNginx Proxy Manager¡£¿ÉÒÔÔÚ¹Ù·½ÍøÕ¾https://nginxproxymanager.com/ÏÂÔØ×îа汾µÄ×°Öðü£¬²¢Æ¾Ö¤¹Ù·½Îĵµ¾ÙÐÐ×°ÖúÍÉèÖá£
½ÓÏÂÀ´£¬ÎÒÃÇÐèÒª½¨ÉèÒ»¸öÓÃÓÚ»á¼û¿ØÖƵÄÓû§ÁÐ±í¡£ÔÚNginx Proxy ManagerµÄÖÎÀí½çÃæÖУ¬µã»÷×ó²àµ¼º½À¸µÄ”Users”°´Å¥£¬ÔÚÓû§ÖÎÀíÒ³Ãæµã»÷”Add User”°´Å¥£¬ÊäÈëÓû§ÃûºÍÃÜÂ룬²¢¹´Ñ¡”Admin”Ñ¡ÏÌåÏÖ¸ÃÓû§¾ßÓÐÖÎÀíԱȨÏÞ£©¡£µã»÷”Save”°´Å¥ÉúÑÄÓû§ÐÅÏ¢¡£
ÏÖÔÚ£¬ÎÒÃÇ¿ÉÒÔͨ¹ýÔÚNginx Proxy ManagerµÄÖÎÀí½çÃæÖÐÉèÖ÷ÓɺÍÖ÷»úÀ´ÊµÏÖ»ùÓÚÓû§µÄ»á¼û¿ØÖÆÕ½ÂÔ¡£¼ÙÉèÎÒÃÇÓÐÁ½¸öÓû§£¬Ò»¸öÊÇÖÎÀíÔ±Óû§admin£¬ÁíÒ»¸öÊÇͨË×Óû§guest¡£ÎÒÃÇÏ£ÍûÖ»ÔÊÐíÖÎÀíÔ±Óû§»á¼ûÍøÕ¾A£¬¶øͨË×Óû§Ö»ÄÜ»á¼ûÍøÕ¾B¡£
Ê×ÏÈ£¬µã»÷×ó²àµ¼º½À¸µÄ”Proxy Hosts”°´Å¥£¬ÔÚÖ÷»úÖÎÀíÒ³Ãæµã»÷”Add Proxy Host”°´Å¥¡£ÔÚн¨Ö÷»úÒ³ÃæÖУ¬Æ¾Ö¤ÒÔÏ°취¾ÙÐÐÉèÖãº
ÔÚ”General”Ñ¡ÏÖУ¬ÌîдÖ÷»úÃû³ÆºÍÖ÷»úµØµã£¬Ñ¡Ôñ¼àÌýµÄ¶Ë¿Ú¡£
ÔÚ”SSL”Ñ¡ÏÖУ¬Ñ¡ÔñÊÇ·ñÆôÓÃSSL£¬²¢ÉÏ´«Ð§ÀÍÆ÷Ö¤ÊéºÍ˽Կ£¨¿ÉÑ¡£©¡£
ÔÚ”Locations”Ñ¡ÏÖУ¬µã»÷”Add Location”°´Å¥¡£ÔÚµ¯³öµÄ¶Ô»°¿òÖУ¬ÌîдLocationÃû³ÆºÍLocationµØµã¡£ÔÚ”Rules”²¿·Ö£¬µã»÷”Add Rule”°´Å¥¡£ÔÚµ¯³öµÄ¶Ô»°¿òÖУ¬Ñ¡Ôñ”User”±äÁ¿£¬²¢Ñ¡Ôñ”equals”²Ù×÷·û¡£ÔÚ”Value”ÊäÈë¿òÖÐÊäÈëÓû§µÄÃû³Æ£¨ÀýÈçadmin£©¡£µã»÷”Add Rule”°´Å¥ÉúÑĹæÔò¡£
µã»÷”Save”°´Å¥ÉúÑÄÖ÷»úÉèÖá£
½ÓÏÂÀ´£¬ÎÒÃÇƾ֤ÉÏÊö°ì·¨Ôٴν¨ÉèÒ»¸öÖ÷»ú£¬²¢ÔÚÆäÖÐÌí¼ÓÒ»¸öLocation£¬¹æÔòÖеÄÓû§Ãû³ÆÉèΪguest¡£
Íê³ÉÉÏÊöÉèÖúó£¬Ö»ÓÐÓû§ÃûΪadminµÄÓû§²Å»ª»á¼ûÍøÕ¾A£¬¶øÓû§ÃûΪguestµÄÓû§Ö»ÄÜ»á¼ûÍøÕ¾B¡£
ÔÚʾÀýÖУ¬ÎÒÃÇʹÓÃÁËNginx Proxy ManagerÌṩµÄÓû§±äÁ¿ºÍ»á¼û¿ØÖƹæÔòÀ´ÊµÏÖ»ùÓÚÓû§µÄ»á¼û¿ØÖÆÕ½ÂÔ¡£Í¨¹ýÎÞаµÄÉèÖã¬ÎÒÃÇ¿ÉÒÔƾ֤²î±ðµÄÓû§ÐèÇó¾ÙÐÐϸÁ£¶ÈµÄ»á¼û¿ØÖÆ£¬±£»¤Ãô¸ÐµÄÐÅÏ¢ºÍ×ÊÔ´¡£´úÂëʾÀýÈçÏ£º
location /websiteA {
location / ... proxy_set_header User $remote_user; ... }
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
}
location /websiteB {
location / ... proxy_set_header User $remote_user; ... }
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
}
ÔÚÉÏÊö´úÂëÖУ¬$remote_user±äÁ¿ÌåÏÖ¿Í»§¶ËµÄÓû§Ãû£¬Í¨¹ýproxy_set_headerÖ¸Á¸Ã±äÁ¿×ª´ï¸øºó¶ËЧÀÍ¡£È»ºó£¬ÎÒÃÇ¿ÉÒÔÔÚºó¶ËЧÀÍÖÐƾ֤ÎüÊÕµ½µÄÓû§ÐÅÏ¢¾ÙÐлá¼û¿ØÖÆ¡£
×ܽáÆðÀ´£¬Ê¹ÓÃNginx Proxy ManagerʵÏÖ»ùÓÚÓû§µÄ»á¼û¿ØÖÆÕ½ÂÔºÜÊǼòÆÓ¡£ÎÒÃÇÖ»ÐèÔÚÖÎÀí½çÃæÖÐÉèÖ÷ÓɺÍÖ÷»ú£¬²¢Í¨¹ýÓû§±äÁ¿ºÍ»á¼û¿ØÖƹæÔò¾ÙÐÐÊÚȨ¼´¿É¡£ÕâΪÎÒÃÇÌṩÁËÎÞаºÍ±ã½ÝµÄÒªÁìÀ´±£»¤Ãô¸ÐµÄÐÅÏ¢ºÍ×ÊÔ´¡£Ï£Íû±¾ÎĶԸ÷ÈËÓÐËù×ÊÖú£¬Ð»Ð»ÔĶÁ£¡
ÒÔÉϾÍÊÇʹÓÃNginx Proxy ManagerʵÏÖ»ùÓÚÓû§µÄ»á¼û¿ØÖÆÕ½ÂÔµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡