web·þÎñÆ÷°²È«£¬UnixµÄWeb·þÎñÆ÷°²È«Ö¸ÄÏ

UnixµÄWeb·þÎñÆ÷°²È«Ö¸ÄÏ - µçÄÔ°²È« - µçÄԽ̳ÌÍø

UnixµÄWeb·þÎñÆ÷°²È«Ö¸ÄÏ

ÈÕÆÚ£º2006-09-30   ¼ö£º
¡¡¡¡ÔÚ¼ÆËã»úÍøÂçÈÕÒæÆÕ¼°µÄ½ñÌ죬¼ÆËã»ú°²È«²»µ«ÒªÇó·ÀÖμÆËã»ú²¡¶¾£¬¶øÇÒÒªÌá¸ßϵͳµÖ¿¹ºÚ¿Í·Ç·¨ÈëÇÖµÄÄÜÁ¦£¬»¹ÒªÌá¸ß¶ÔÔ¶³ÌÊý¾Ý´«ÊäµÄ±£ÃÜÐÔ£¬±ÜÃâÔÚ´«Êä;ÖÐÔâÊÜ·Ç·¨ÇÔÈ¡¡£±¾ÎĽö½öÌÖÂÛÔÚ¹¹ÔìWeb·þÎñÆ÷ʱ¿ÉÄܳöÏÖµÄһЩÇé¿ö£¬Ï£ÍûÄÜÒýÆðÖØÊÓ¡£Ò».¡¡°²È«Â©¶´Web·þÎñÆ÷ÉϵÄ©¶´¿ÉÒÔ´ÓÒÔϼ¸·½Ã濼ÂÇ£º1.ÔÚWeb·þÎñÆ÷ÉÏÄã²»ÈÃÈË·ÃÎʵÄÃØÃÜÎļþ¡¢Ä¿Â¼»òÖØÒªÊý¾Ý¡£2.´ÓÔ¶³ÌÓû§Ïò·þÎñÆ÷·¢ËÍÐÅϢʱ£¬ÌرðÊÇÐÅÓÿ¨Ö®ÀණÎ÷ʱ£¬ÖÐ;Ôâ²»·¨·Ö×Ó·Ç·¨À¹½Ø¡£3.Web·þÎñÆ÷±¾Éí´æÔÚһЩ©¶´£¬Ê¹µÃһЩÈËÄÜÇÖÈëµ½Ö÷»úϵͳ£¬ÆÆ»µÒ»Ð©ÖØÒªµÄÊý¾Ý£¬ÉõÖÁÔì³Éϵͳ̱»¾¡£4.CGI°²È«·½ÃæµÄ©¶´ÓУº(1)ÓÐÒâ»òÎÞÒâÔÚÖ÷»úϵͳÖÐÒÅ©Bugs¸ø·Ç·¨ºÚ¿Í´´ÔìÌõ¼þ¡£(2)ÓÃCGI½Å±¾±àдµÄ³ÌÐòµ±Éæ¼°µ½Ô¶³ÌÓû§´Óä¯ÀÀÆ÷ÖÐÊäÈë±í¸ñ(Form)£¬²¢½øÐмìË÷(Search¡¡index)£¬»òform-mailÖ®ÀàÔÚÖ÷»úÉÏÖ±½Ó²Ù×÷ÃüÁîʱ£¬»òÐí»á¸øWebÖ÷»úϵͳÔì³ÉΣÏÕ¡£5.»¹ÓÐһЩ¼òµ¥µÄ´ÓÍøÉÏÏÂÔصÄWeb·þÎñÆ÷£¬Ã»Óйý¶à¿¼Âǵ½Ò»Ð©°²È«ÒòËØ£¬²»ÄÜÓÃ×÷ÉÌÒµÓ¦Óá£Òò´Ë£¬²»¹ÜÊÇÅäÖ÷þÎñÆ÷£¬»¹ÊÇÔÚ±àдCGI³ÌÐòʱ¶¼Òª×¢ÒâϵͳµÄ°²È«ÐÔ¡£¾¡Á¿¶ÂסÈκδæÔڵĩ¶´£¬´´Ô찲ȫµÄ»·¾³¡£¶þ.¡¡Ìá¸ßϵͳ°²È«ÐÔºÍÎȶ¨ÐÔWeb·þÎñÆ÷°²È«Ô¤·À´ëÊ©£º1.ÏÞÖÆÔÚWeb·þÎñÆ÷¿ªÕË»§£¬¶¨ÆÚɾ³ýһЩ¶Ï½ø³ÌµÄÓû§¡£2.¶ÔÔÚWeb·þÎñÆ÷ÉÏ¿ªµÄÕË»§£¬ÔÚ¿ÚÁ¶È¼°¶¨ÆÚ¸ü¸Ä·½Ãæ×÷³öÒªÇ󣬷ÀÖ¹±»µÁÓá£3.¾¡Á¿Ê¹FTP¡¢MAILµÈ·þÎñÆ÷ÓëÖ®·Ö¿ª£¬È¥µôftp,sendmail,tftp,NIS,¡¡NFS£¬finger,netstatµÈһЩÎ޹صÄÓ¦Óá£4.ÔÚWeb·þÎñÆ÷ÉÏÈ¥µôһЩ¾ø¶Ô²»ÓõÄÈçSHELLÖ®ÀàµÄ½âÊÍÆ÷£¬¼´µ±ÔÚÄãµÄCGIµÄ³ÌÐòÖÐûÓõ½PERLʱ£¬¾Í¾¡Á¿°ÑPERLÔÚϵͳ½âÊÍÆ÷ÖÐɾ³ýµô¡£5.¶¨Æڲ鿴·þÎñÆ÷ÖеÄÈÕÖ¾logsÎļþ£¬·ÖÎöÒ»ÇпÉÒÉʼþ¡£ÔÚerrorlogÖгöÏÖrm,¡¡login,¡¡/bin/perl,¡¡/bin/shµÈÖ®Àà¼Ç¼ʱ£¬ÄãµÄ·þÎñÆ÷¿ÉÄÜÒѾ­Êܵ½ÁËһЩ·Ç·¨Óû§µÄÈëÇÖ¡£6.ÉèÖúÃWeb·þÎñÆ÷ÉÏϵͳÎļþµÄȨÏÞºÍÊôÐÔ£¬¶Ô¿ÉÈÃÈË·ÃÎʵÄÎĵµ·ÖÅäÒ»¸ö¹«ÓõÄ×飬ÈçWWW£¬²¢Ö»·ÖÅäËüÖ»¶ÁµÄȨÀû¡£°ÑËùÓеÄHTMLÎļþ¹éÊôWWW×飬ÓÉWeb¹ÜÀíÔ±¹ÜÀíWWW×é¡£¶ÔÓÚWebµÄÅäÖÃÎļþ½ö¶ÔWeb¹ÜÀíÔ±ÓÐдµÄȨÀû¡£7.ÓÐЩWeb·þÎñÆ÷°ÑWebµÄÎĵµÄ¿Â¼ÓëFTPĿ¼ָÔÚͬһĿ¼ʱ£¬Ó¦¸Ã×¢Òâ²»Òª°ÑFTPµÄĿ¼ÓëCGI-BINÖ¸¶¨ÔÚÒ»¸öĿ¼֮Ï¡£ÕâÑùÊÇΪÁË·ÀֹһЩÓû§Í¨¹ýFTPÉÏÔØһЩÈçPERL»òSHÖ®Àà³ÌÐò£¬²¢ÓÃWebµÄCGI-BINÈ¥Ö´ÐУ¬Ôì³É²»Á¼ºó¹û¡£8.ͨ¹ýÏÞÖÆÐí¿É·ÃÎÊÓû§IP»òDNS£¬ÈçÔÚNCSAÖеÄaccess.confÖмÓÉÏ£º¡¶Directory¡¡/full/path/to/directory¡·¡¶Limit¡¡GET¡¡POST¡·order¡¡mutual-failuredeny¡¡from¡¡allallow¡¡from¡¡168.160.142.¡¡abc.net.cn¡¶/Limit¡·¡¶/Directory¡·ÕâÑùÖ»ÄÜÊÇÒÔÓòÃûΪabc.net.cn»òIPÊôÓÚ168.160.142µÄ¿Í»§·ÃÎʸÃWeb·þÎñÆ÷¡£¶ÔÓÚCERN»òW3C·þÎñÆ÷¿ÉÒÔÕâÑùÔÚhttpd.confÖмÓÉÏ£ºProtection¡¡LOCAL-USERS¡¡{GetMask¡¡@(*.capricorn.com,¡¡*.zoo.org,¡¡18.157.0.5)}Protect¡¡/relative/path/to/directory/*¡¡LOCAL-USERS9.WINDOWSÏÂHTTPD(1)Netscape¡¡Communications¡¡Server¡¡for¡¡NTPERL½âÊÍÆ÷µÄ©¶´£ºNetscape¡¡Communications¡¡ServerÖÐÎÞ·¨Ê¶±ðCGI-BINϵÄÀ©Õ¹Ãû¼°ÆäÓ¦ÓùØϵ£¬Èç.plÎļþÊÇPERLµÄ´úÂë³ÌÐò×Ô¶¯µ÷ÓõĽâÊÍÎļþ£¬¼´Ê¹ÏÖÔÚÒ²Ö»ÄÜ°Ñperl.exeÎļþ´æ·ÅÔÚCGI-BINĿ¼֮Ï¡£Ö´ÐÐÈ磺/cgi-bin/perl.exe?&my_script.pl¡£µ«ÊÇÕâ¾Í¸øÈκÎÈ˶¼ÓÐÖ´ÐÐPERLµÄ¿ÉÄÜ£¬µ±ÓÐЩÈËÔÚÆää¯ÀÀÆ÷µÄURLÖмÓÉÏÈ磺/cgi-bin/perl.exe?&-e unlink ʱ£¬ÓпÉÄÜÔì³Éɾ³ý·þÎñÆ÷µ±Ç°Ä¿Â¼ÏÂÎļþµÄΣÏÕ¡£µ«ÊÇ£¬ÆäËûÈ磺O¡äReilly¡¡WebSite»òPurveyor¶¼²»´æÔÚÕâÖÖ©¶´¡£CGIÖ´ÐÐÅú´¦ÀíÎļþµÄ©¶´:Îļþtest.batµÄÄÚÈÝÈçÏ£º@echo¡¡offecho¡¡Content-type:¡¡text/plainechoecho¡¡Hello¡¡World!Èç¹û¿Í»§ä¯ÀÀÆ÷µÄURLΪ£º/cgi-bin/test.bat?&dir£¬ÔòÖ´Ðе÷ÓÃÃüÁî½âÊÍÆ÷Íê³ÉDIRÁÐ±í¡£Õâ¾ÍÈ÷ÃÎÊÕßÓÐÖ´ÐÐÆäËûÃüÁî¿ÉÄÜÐÔ¡£(2)O¡äReilly¡¡WebSite¡¡server¡¡for¡¡Windows¡¡NT/95ÔÚWebSite1.1BÒÔÇ°µÄ°æ±¾ÖÐʹÓÃÅú´¦ÀíÎļþ´æÔÚ×ÅÓëNetscapeͬÑùµÄ©¶´£¬µ«ÊÇ£¬Ð°æ¹Ø±ÕÁË.batÔÚCGIÖеÄ×÷Óá£Ö§³ÖPERL£¬Ð°潫VBºÍC×÷ΪCGI¿ª·¢¹¤¾ß¡£(3)Microsoft¡äs¡¡IIS¡¡Web¡¡Server1996Äê3ÔÂ5ÈÕÇ°µÄIISÔÚNTϵÄBUGÑÏÖØ£¬¿ÉÒÔÈÎÒâʹÓÃcommandÃüÁî¡£µ«Ö®ºóÒÑÐÞ²¹Á˸鶴£¬Äã¿É¼ì²éÄãµÄ¿ÉÖ´ÐÐÎļþµÄ½¨Á¢ÈÕÆÚ¡£IIS3.0»¹´æÔÚһЩ°²È«BUG£¬Ö÷ÒªÊÇCGI-BINϵĸ²¸øȨÀû¡£ÁíÍ⣬Ðí¶àWeb·þÎñÆ÷±¾Éí¶¼´æÔÚһЩ°²È«ÉϵÄ©¶´£¬¶¼ÊÇÔÚ°æ±¾Éý¼¶¹ý³ÌÖб»²»¶Ï¸üÐÂÁË£¬Ôڴ˾Ͳ»Ò»Ò»ÁоÙÁË¡£Èý.¡¡´ÓCGI±à³Ì½Ç¶È¿¼ÂÇ°²È«¡£1.²ÉÓñàÒëÓïÑԱȽâÊÍÓïÑÔ»á¸ü°²È«Ð©,²¢ÇÒCGI³ÌÐòÓ¦·ÅÔÚ¶ÀÁ¢ÓÚHTML´æ·ÅĿ¼֮ÍâµÄCGI-BINÏÂ,ÕâÊÇΪÁË·ÀֹһЩ·Ç·¨·ÃÎÊÕß´Óä¯ÀÀÆ÷¶ËÈ¡µÃ½âÊÍÐÔÓïÑÔµÄÔ­´úÂëºó´ÓÖÐÑ°ÕÒ©¶´¡£2.ÔÚÓÃCÀ´±àдCGI³ÌÐòʱӦ¾¡Á¿ÉÙÓÃpopen()¡¢system()¡¢ËùÓÐÉæ¼°/bin/shµÄSHELLÃüÁîÒÔ¼°ÔÚPERLÖеÄsystem()¡¢exec()¡¢open()¡¢eval()µÈexec»òevalÖ®ÀàÃüÁî¡£ÔÚÓÉÓû§ÌîдµÄform»¹»ØCGIʱ£¬²»ÒªÖ±½Óµ÷ÓÃsystem()Ö®ÀຯÊý¡£ÁíÍ⣬¶ÔÓÚÊý¾ÝµÄ¼ÓÃÜÓë´«Ê䣬ĿǰÓÐSSL¡¢SHTTP¡¢SHENµÈЭÒ鹩´ó¼ÒÑо¿¡£ËÄ.¡¡·À»ðǽ(Firewall)1.·À»ðǽµÄ¸ÅÄî·À»ðǽ(Firewall)ÊÇÖ¸Ò»¸öÓÉÈí¼þ»òÓÉÈí¼þºÍÓ²¼þÉ豸×éºÏ¶ø³É£¬´¦ÓÚÆóÒµ»òÍøÂçȺÌå¼ÆËã»úÓëÍâ½çͨµÀ(Internet)Ö®¼ä£¬ÏÞÖÆÍâ½çÓû§¶ÔÄÚ²¿ÍøÂçµÄ·ÃÎʼ°¹ÜÀíÄÚ²¿Óû§·ÃÎÊÍâ½çÍøÂçµÄȨÏÞ¡£2.·À»ðǽµÄ´ëÊ©(1)´úÀí(Proxy)Ö÷»ú"ÄÚ²¿ÍøÂç--´úÀíÍø¹Ø(Proxy¡¡Gateway)--Internet"ÕâÖÖ·½Ê½ÊÇÄÚ²¿ÍøÂçÓëInternet²»Ö±½ÓͨѶ¡£¾ÍÊÇÄÚ²¿ÍøÂç¼ÆËã»úÓû§Óë´úÀíÍø¹Ø²ÉÓÃÒ»ÖÖͨѶ·½Ê½£¬¼´ÌṩÄÚ²¿ÍøÂçЭÒé(Netbios¡¢TCP/IPµÈ)£¬¶øÍø¹ØÓëInternetÖ®¼ä²ÉÈ¡µÄÊDZê×¼TCP/IPÍøÂçͨѶЭÒé¡£ÕâÑùʹµÃÍøÂçÊý¾Ý°ü²»ÄÜÖ±½ÓÔÚÄÚÍâÍøÂçÖ®¼ä½øÐС£ÄÚ²¿¼ÆËã»ú±ØÐëͨ¹ý´úÀíÍø¹Ø·ÃÎÊInternet£¬ÕâÑùÈÝÒ×ÔÚ´úÀí·þÎñÆ÷É϶ÔÄÚ²¿ÍøÂç¼ÆËã»ú·ÃÎÊÍâ½ç¼ÆËã»ú½øÐÐÏÞÖÆ¡£ÁíÍ⣬ÓÉÓÚ´úÀí·þÎñÆ÷Á½¶Ë²ÉÓò»Í¬Ð­Òé±ê×¼Ò²¿ÉÒÔÖ±½Ó×èÖ¹Íâ½ç·Ç·¨ÈëÇÖ¡£»¹ÓУ¬´úÀí·þÎñÆ÷µÄÍø¹Ø¿É¶ÔÊý¾Ý·â°ü½øÐÐÑéÖ¤ºÍ¶ÔÃÜÂë½øÐÐÈ·ÈϵȰ²È«¹ÜÖÆ¡£ÕâÑù£¬ÄܽϺõؿØÖƹÜÀíÁ½¶ËµÄÓû§£¬Æðµ½·À»ðǽ×÷ÓᣠÒòΪÕâÖÖ·À»ðǽ´ëÊ©ÊDzÉÓÃ͸¹ý´úÀí·þÎñÆ÷½øÐУ¬ÔÚÁª»úÓû§¶àʱ£¬Ð§ÂʱØÈ»Êܵ½Ó°Ï죬´úÀí·þÎñÆ÷¸ºµ£ºÜÖØ£¬ËùÒÔÐí¶à·ÃÎÊInternetµÄ¿Í»§Èí¼þÔÚÄÚ²¿ÍøÂç¼ÆËã»úÖпÉÄÜÎÞ·¨Õý³£·ÃÎÊInternet¡£(2)·ÓÉÆ÷¼Ó¹ýÂËÆ÷Íê³É"ÄÚ²¿ÍøÂç--¹ýÂËÆ÷(Filter)--·ÓÉÆ÷(Router)--Internet"ÕâÖֽṹÓÉ·ÓÉÆ÷ºÍ¹ýÂËÆ÷¹²Í¬Íê³É´ÓIPµØÖ·»òÓòÃûÉ϶ÔÍâ½ç¼ÆËã»ú·ÃÎÊÄÚ²¿ÍøÂçµÄÏÞÖÆ£¬Ò²¿ÉÒÔÖ¸¶¨»òÏÞÖÆÄÚ²¿ÍøÂç·ÃÎÊInternet¡£Â·ÓÉÆ÷½ö¶ÔÖ÷»úÉÏÌض¨µÄPORTÉϵÄÊý¾ÝͨѶ¼ÓÒÔ·ÓÉ£¬¶ø¹ýÂËÆ÷ÔòÖ´ÐÐɸѡ¡¢¹ýÂË¡¢ÑéÖ¤¼°Æ䰲ȫ¼à¿Ø£¬ÕâÑù¿ÉÒԺܴó³Ì¶ÈÉϸô¶ÏÄÚÍâÍøÂç¼äµÄ²»Õý³£µÄ·ÃÎʵǼ¡£
±êÇ©£º