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

ÔõÑùʹÓÃNginx¾ÙÐÐHTTPÇëÇóµÄÄÚÈݹýÂ˺ͷÀ»ðǽ

ÔõÑùʹÓÃnginx¾ÙÐÐhttpÇëÇóµÄÄÚÈݹýÂ˺ͷÀ»ðǽ

¸ÅÊö£º

Ëæ×Å»¥ÁªÍøµÄÉú³¤£¬WebÓ¦ÓóÌÐòµÄÇå¾²ÐÔÔ½À´Ô½Êܵ½¹Ø×¢¡£ÆäÖУ¬HTTPÇëÇóµÄÄÚÈݹýÂ˺ͷÀ»ðǽÊDZ£»¤WebЧÀÍÆ÷ÃâÊܶñÒâ¹¥»÷µÄÒªº¦²½·¥Ö®Ò»¡£±¾ÎĽ«ÏÈÈÝÔõÑùʹÓÃnginx¾ÙÐÐhttpÇëÇóµÄÄÚÈݹýÂ˺ͷÀ»ðǽÉèÖã¬ÒÔÌá¸ßWebЧÀÍÆ÷µÄÇå¾²ÐÔ¡£

×°ÖÃNginx

Ê×ÏÈ£¬ÎÒÃÇÐèҪװÖÃNginx¡£¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁîÔÚLinuxϵͳÉϾÙÐÐ×°Öãº

sudo apt-get install nginx

µÇ¼ºó¸´ÖÆ

ÉèÖÃNginx

½ÓÏÂÀ´£¬ÎÒÃÇÐèÒªÉèÖÃNginxÒÔʵÏÖHTTPÇëÇóµÄÄÚÈݹýÂ˺ͷÀ»ðǽ¹¦Ð§¡£·­¿ªNginxµÄÉèÖÃÎļþ¾ÙÐб༭£º

sudo nano /etc/nginx/nginx.conf

µÇ¼ºó¸´ÖÆ

ÔÚhttp²¿·ÖÉèÖÃÖÐÌí¼ÓÒÔÏÂÄÚÈÝ£º

http {
  ...
  server {
    ...
    
    # ÉèÖ÷À»ðǽ¹æÔò
    location / {
      deny 192.168.0.1;
      allow all;
    }
    
    # ÉèÖÃÄÚÈݹýÂ˹æÔò
    location ~* (eval(|base64_) {
      return 403;
    }
    
    ...
  }
  ...
}

µÇ¼ºó¸´ÖÆ

ÒÔÉÏÉèÖÃʵÏÖÁË×èÖ¹IPµØµãΪ192.168.0.1µÄÓû§»á¼ûЧÀÍÆ÷£¬²¢Õ¥È¡°üÀ¨eval(ºÍbase64_µÄÇëÇó¡£

ÖØÆôNginx

ÉúÑIJ¢Í˳öÉèÖÃÎļþºó£¬ÎÒÃÇÐèÒªÖØÆôNginxЧÀÍÒÔʹÉèÖÃÉúЧ£º

sudo systemctl restart nginx

µÇ¼ºó¸´ÖÆ

ÑéÖ¤ÉèÖÃ

ÏÖÔÚ£¬ÎÒÃÇ¿ÉÒÔÑéÖ¤NginxµÄÄÚÈݹýÂ˺ͷÀ»ðǽÉèÖÃÊÇ·ñÉúЧ¡£ÈÃÎÒÃǼÙÉèWebЧÀÍÆ÷µÄIPµØµãΪ192.168.0.100¡£

Ê×ÏÈ£¬ÊµÑéʹÓÃIPµØµãΪ192.168.0.1µÄ¿Í»§¶Ë»á¼ûЧÀÍÆ÷¡£ÈôÊÇÒ»ÇÐÕý³££¬¿Í»§¶Ë½«ÎÞ·¨ÅþÁ¬µ½Ð§ÀÍÆ÷²¢ÊÕµ½403 ForbiddenµÄ¹ýʧ¡£

È»ºó£¬ÊµÑéʹÓÃÒÔÏÂÇëÇó»á¼ûЧÀÍÆ÷£º

curl -X GET 'http://192.168.0.100/index.php?test=eval(base64_encode("hello world"))'

µÇ¼ºó¸´ÖÆ

ÈôÊÇÒ»ÇÐÕý³££¬¿Í»§¶Ë½«ÊÕµ½403 ForbiddenµÄ¹ýʧ¡£

ͨ¹ýÑéÖ¤£¬ÎÒÃÇ¿ÉÒÔÈ·¶¨NginxµÄÄÚÈݹýÂ˺ͷÀ»ðǽÉèÖÃÒѾ­ÉúЧ¡£

½áÂÛ£º

±¾ÎÄÏÈÈÝÁËÔõÑùʹÓÃnginx¾ÙÐÐhttpÇëÇóµÄÄÚÈݹýÂ˺ͷÀ»ðǽÉèÖá£Í¨¹ýÉèÖÃNginx£¬ÎÒÃÇ¿ÉÒÔÓÐÓõر£»¤WebЧÀÍÆ÷ÃâÊܶñÒâ¹¥»÷¡£Òª×¢ÖصÄÊÇ£¬ÎÒÃÇ¿ÉÒÔƾ֤ÏÖʵÐèÇóÐÞ¸ÄÉèÖÃÎļþÒÔ˳Ӧ²î±ðµÄÇå¾²ÒªÇó¡£

ÒÔÉϾÍÊÇÔõÑùʹÓÃNginx¾ÙÐÐHTTPÇëÇóµÄÄÚÈݹýÂ˺ͷÀ»ðǽµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

QR code
ÍøÕ¾µØͼ