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

NginxÏÞÖÆIP»á¼ûÉèÖà £¬ÌáÉýÍøÕ¾Çå¾²ÐÔ

nginxÏÞÖÆip»á¼ûÉèÖà £¬ÌáÉýÍøÕ¾Çå¾²ÐÔ

Ëæ×Å»¥ÁªÍøµÄ¿ìËÙÉú³¤ £¬ÍøÂçÇå¾²ÎÊÌâÖð½¥Êܵ½ÈËÃǵÄÖØÊÓ¡£¹ØÓÚÍøÕ¾ÖÎÀíÔ±À´Ëµ £¬È·±£Ð§ÀÍÆ÷µÄÇå¾²ÊǺÜÊÇÖ÷ÒªµÄ¡£Nginx×÷Ϊһ¿î¸ßÐÔÄܵÄWebЧÀÍÆ÷ £¬¾ßÓÐÎÞаµÄÉèÖÃÑ¡Ïî £¬¿ÉÒÔͨ¹ýÏÞÖÆIP»á¼ûÀ´ÌáÉýÍøÕ¾µÄÇå¾²ÐÔ¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚNginxÖÐÉèÖÃIP»á¼ûÏÞÖÆ £¬²¢ÌṩÏà¹ØµÄ´úÂëʾÀý¡£

ÔÚNginxÖÐ £¬¿ÉÒÔʹÓÔallow”ºÍ”deny”Ö¸ÁîÀ´ÊµÏÖIP»á¼ûÏÞÖÆ¡£”allow”Ö¸ÁîÓÃÓÚÔÊÐíÌض¨µÄIPµØµã»òIPµØµã¶Î»á¼ûЧÀÍÆ÷ £¬”deny”Ö¸ÁîÓÃÓÚ×èÖ¹Ìض¨µÄIPµØµã»òIPµØµã¶Î»á¼ûЧÀÍÆ÷¡£ÒÔÏÂÊÇÒ»¸ö¼òÆÓµÄÉèÖÃʾÀý£º

location / {
    deny 192.168.0.1;
    allow 192.168.0.0/24;
    deny all;
}

µÇ¼ºó¸´ÖÆ

ÉÏÃæµÄÉèÖý«¾Ü¾øIPµØµãΪ192.168.0.1µÄ»á¼û £¬²¢ÔÊÐíIPµØµã¶ÎΪ192.168.0.0/24µÄ»á¼û¡£¹ØÓÚÆäËûIPµØµã £¬Ôò»á±»¾Ü¾ø»á¼û¡£

ËäÈ» £¬³ýÁ˵¥¸öIPµØµãºÍIPµØµã¶ÎÍâ £¬»¹¿ÉÒÔʹÓÃÕýÔò±í´ïʽÀ´Æ¥ÅäIPµØµã¡£ÒÔÏÂÊÇÒ»¸öʹÓÃÕýÔò±í´ïʽµÄÉèÖÃʾÀý£º

location / {
    deny ^192.168.[0-9]+.[0-9]+$;
    allow all;
}

µÇ¼ºó¸´ÖÆ

ÉÏÃæµÄÉèÖý«¾Ü¾øÒÔ192.168¿ªÍ·µÄIPµØµãµÄ»á¼û £¬¹ØÓÚÆäËûIPµØµã £¬ÔòÔÊÐí»á¼û¡£

ÁíÍâ £¬ÓÐʱÎÒÃÇ¿ÉÄÜÐèÒª¶ÔijЩÌض¨µÄURL·¾¶¾ÙÐÐIP»á¼ûÏÞÖÆ £¬¶ø²»ÊÇÕû¸öÍøÕ¾¡£¿ÉÒÔͨ¹ýÔöÌíÒ»¸öÌØÁíÍâlocation¿éÀ´ÊµÏÖÕâÒ»µã¡£ÒÔÏÂÊÇÒ»¸öÕë¶ÔÌض¨URL·¾¶µÄIP»á¼ûÏÞÖƵÄÉèÖÃʾÀý£º

location /admin {
    deny all;
}

location / {
    allow all;
}

µÇ¼ºó¸´ÖÆ

ÉÏÃæµÄÉèÖý«Õ¥È¡¶Ô/admin·¾¶µÄ»á¼û £¬¶ø¹ØÓÚÆäËû·¾¶Ôò²»¾ÙÐÐÏÞÖÆ¡£

³ýÁËÉÏÊö»ù±¾µÄIP»á¼ûÏÞÖÆÉèÖÃÖ®Íâ £¬Nginx»¹ÌṩÁËÆäËûһЩÉèÖÃÑ¡Ïî £¬ÓÃÓÚ¸üϸÄåµØ¿ØÖÆ»á¼ûȨÏÞ¡£ÀýÈç £¬¿ÉÒÔʹÓÔgeo”Ä£¿éÀ´Æ¾Ö¤µØÓßλÖöÔIP¾ÙÐÐÏÞÖÆ £¬Ò²¿ÉÒÔʹÓÔlimit_req”Ä£¿é¶ÔÇëÇó¾ÙÐÐƵÂÊÏÞÖÆ¡£ÓйØÕâЩ¸ß¼¶ÉèÖÃÑ¡ÏîµÄÏêϸʹÓà £¬Çë²ÎÔÄNginxµÄ¹Ù·½Îĵµ¡£

×ܽáÆðÀ´ £¬NginxµÄIP»á¼ûÏÞÖÆÉèÖÃÊÇÌá¸ßÍøÕ¾Çå¾²ÐÔµÄÖ÷ÒªÊֶΡ£Í¨¹ýºÏÀíÉèÖà £¬¿ÉÒÔʵÏÖ¶ÔÌض¨IPµØµã»òIPµØµã¶ÎµÄÏÞÖÆ £¬Ò²¿ÉÒÔͨ¹ýÕýÔò±í´ïʽʵÏÖ¶ÔIPµØµãµÄÔ½·¢ÎÞаµÄÆ¥Åä¡£±ðµÄ £¬»¹¿ÉÒÔͨ¹ýÕë¶ÔÌض¨URL·¾¶µÄ»á¼ûÏÞÖÆ £¬½øÒ»²½ÌáÉýÍøÕ¾µÄÇå¾²ÐÔ¡£Ï£Íû±¾ÎÄÄܹ»×ÊÖú¶ÁÕ߸üºÃµØʹÓÃNginxÀ´±£»¤×Ô¼ºµÄÍøÕ¾¡£

ÒÔÉϾÍÊÇNginxÏÞÖÆIP»á¼ûÉèÖà £¬ÌáÉýÍøÕ¾Çå¾²ÐÔµÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

QR code
ÍøÕ¾µØͼ