×ðÁú¿­Ê±¹ÙÍøµÇ¼

¹¹½¨¸ß¿ÉÓÃÐԵĸºÔØƽºâϵͳ£ºNginx Proxy ManagerµÄ×î¼Ñʵ¼ù

¹¹½¨¸ß¿ÉÓÃÐԵĸºÔØƽºâϵͳ£ºNginx Proxy ManagerµÄ×î¼Ñʵ¼ù

СÐò£º

ÔÚ»¥ÁªÍøÓ¦ÓõÄÉú³¤ÖÐ £¬¸ºÔØƽºâϵͳÊDZز»¿ÉÉÙµÄ×é¼þÖ®Ò»¡£ËüÄܹ»Í¨¹ý½«ÇëÇó·Ö·¢µ½¶ą̀ЧÀÍÆ÷ÉÏ £¬ÊµÏָ߲¢·¢¡¢¸ß¿ÉÓÃÐÔµÄЧÀÍ¡£Nginx Proxy ManagerÊÇÒ»¿î³£ÓõĸºÔØƽºâÈí¼þ £¬±¾ÎĽ«ÏÈÈÝÔõÑùʹÓÃNginx Proxy Manager¹¹½¨Ò»¸ö¸ß¿ÉÓÃÐԵĸºÔØƽºâϵͳ £¬²¢ÌṩһЩÏÖʵµÄ´úÂëʾÀý¡£

Ò»¡¢×°ÖÃNginx Proxy Manager

ÏÂÔغÍ×°ÖÃNginx Proxy Manager£º

$ wget http://nginx.org/download/nginx-1.20.1.tar.gz
$ tar -zxf nginx-1.20.1.tar.gz
$ cd nginx-1.20.1
$ ./configure
$ make
$ sudo make install

µÇ¼ºó¸´ÖÆ

ÉèÖÃNginx Proxy Manager£º

$ cd /etc/nginx/
$ sudo vim nginx.conf

µÇ¼ºó¸´ÖÆ

ÔÚnginx.confÖÐÌí¼ÓÒÔÏÂÄÚÈÝ£º

http {
    upstream backend {
        server server1.example.com;
        server server2.example.com;
        server server3.example.com;
    }

    server {
        listen 80;
        location / {
            proxy_pass http://backend;
        }
    }
}

µÇ¼ºó¸´ÖÆ

Èý¡¢ÊµÏָ߿ÉÓÃÐÔ

ΪÁËʵÏָ߿ÉÓÃÐÔ £¬ÎÒÃÇ¿ÉÒÔÉèÖöà¸öNginx Proxy ManagerЧÀÍÆ÷ £¬²¢Ê¹ÓÃNginxµÄupstreamÄ£¿éÀ´¾ÙÐиºÔØƽºâ¡£ÒÔÏÂÊÇһЩ×î¼Ñʵ¼ù£º

ʹÓÃÓòÃûÂÖѯ£¨Round Robin£©£º

upstream backend {
    ip_hash;
    server server1.example.com;
    server server2.example.com;
    server server3.example.com;
}

µÇ¼ºó¸´ÖÆ

ip_hashÖ¸Áî¿ÉÒÔʹÿ¸ö¿Í»§¶ËµÄÇëÇó¶¼Ê¼ÖÕÓÉÏàͬµÄºó¶ËЧÀÍÆ÷´¦Àí¡£

ÔöÌí¿µ½¡¼ì²é£º

upstream backend {
    server server1.example.com;
    server server2.example.com backup;
    server server3.example.com;
    
    health_check interval=5s;
}

µÇ¼ºó¸´ÖÆ

health_checkÖ¸Áî¿É°´ÆÚ¼ì²éºó¶ËЧÀÍÆ÷ÊÇ·ñ¿ÉÓà £¬²¢½«²»¿ÉÓõÄЧÀÍÆ÷ÔÝʱ´Ó¸ºÔØƽºâ³ØÖÐÌÞ³ý £¬È·±£Ö»Óпµ½¡µÄЧÀÍÆ÷¼ÓÈëÇëÇó´¦Àí¡£

ʹÓÃȨÖØ£º

upstream backend {
    server server1.example.com weight=3;
    server server2.example.com weight=2;
    server server3.example.com weight=1;
}

µÇ¼ºó¸´ÖÆ

weightÖ¸Áî¿ÉÒÔƾ֤ºó¶ËЧÀÍÆ÷µÄÐÔÄÜ £¬·ÖÅɲî±ðµÄȨÖØ £¬´Ó¶øʵÏÖÔ½·¢ºÏÀíµÄ¸ºÔØƽºâ¡£

ËÄ¡¢¼à¿ØºÍµ÷ÓÅ

ÔÚÏÖʵӦÓÃÖÐ £¬ÎÒÃÇÐèÒª¶ÔNginx Proxy ManagerµÄÐÔÄܾÙÐÐʵʱ¼à¿Ø £¬²¢¶ÔÆä¾ÙÐе÷ÓÅÒÔÌáÉýϵͳµÄÎȹÌÐÔ¡£ÒÔÏÂÊÇһЩ½¨Ò飺

ʹÓÃNginx״̬Ä£¿é£º

ÔÚnginx.confÖÐÌí¼ÓÒÔÏÂÄÚÈÝ£º

location /nginx_status {
    stub_status;
}

µÇ¼ºó¸´ÖÆ

ͨ¹ý»á¼ûhttp://your-domain/nginx_status £¬¿ÉÒÔ»ñÈ¡µ½NginxµÄ״̬ÐÅÏ¢ £¬ÈçÇëÇó×ÜÊý¡¢»îÔ¾ÅþÁ¬ÊýµÈ¡£

ƾ֤¼à¿ØЧ¹û¾ÙÐе÷ÓÅ£º

ͨ¹ý¼à¿Ø £¬ÎÒÃÇ¿ÉÒÔ·¢Ã÷һЩÐÔÄÜÆ¿¾± £¬ºÃ±ÈÅþÁ¬ÊýÁè¼ÝÏÞÖÆ¡¢ÇëÇóÏìӦʱ¼ä¹ý³¤µÈ¡£Æ¾Ö¤¼à¿ØЧ¹û £¬ÎÒÃÇ¿ÉÒÔÊÊʱµ÷½âNginx Proxy ManagerµÄÉèÖà £¬ÈçÔöÌíworker_processesÊýÄ¿¡¢µ÷½âºó¶ËЧÀÍÆ÷µÄȨÖصÈ¡£

Îå¡¢×ܽá

±¾ÎÄÏÈÈÝÁËÔõÑùʹÓÃNginx Proxy Manager¹¹½¨¸ß¿ÉÓÃÐԵĸºÔØƽºâϵͳ £¬²¢ÌṩÁËһЩÏÖʵµÄ´úÂëʾÀý¡£Í¨¹ýºÏÀíÉèÖúͼà¿Øµ÷ÓÅ £¬ÎÒÃÇ¿ÉÒÔÌáÉý¸ºÔØƽºâϵͳµÄÐÔÄܺͿɿ¿ÐÔ £¬ÎªÓû§Ìṩ¸üºÃµÄЧÀÍÌåÑé¡£

²Î¿¼×ÊÁÏ£º

[Nginx¹Ù·½Îĵµ](http://nginx.org/en/docs/)

[Nginx Wiki](https://wiki.nginx.org/Main)

À©Õ¹ÔĶÁ£º

[NginxÊÃ÷ÈÕ½](https://book.douban.com/subject/26378178/)

[Nginx¸ßÐÔÄÜWebЧÀÍÆ÷Ïê½â](https://book.douban.com/subject/6786600/)

ÒÔÉϾÍÊǹ¹½¨¸ß¿ÉÓÃÐԵĸºÔØƽºâϵͳ£ºNginx Proxy ManagerµÄ×î¼Ñʵ¼ùµÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ