Next Previous Contents

7. Apache

Apache³Ì·sª©¥»¬°1.3.9¡C¥¦ªº¥D­nºô¯¸¬° http://www.apache.org/¡C Apacheweek¤]¦³¤£¿ùªº¸ê®Æºô¯¸¬°¡G http://www.apacheweek.com/¡C Apacheªº¤å¥óÁÙ¦n°Õ¡I©Ò¥H§Ú¤£¥²¦A¦h¥[²Ó­z¦p¦ó³]©wApache¡C¥L­Ì¦bºô¯¸¤W¡A¤]¸ò ­ì©lµ{¦¡¦b¤@°_¡£HTML®æ¦¡¡¤¡CÁöµM¤]¦³¤@¯ë¤å¦rÀɮ榡¡A¦ý¥HHTML®æ¦¡¸û¨Î¡Cµ¥ ¨ìApache Documentation Project§¹¦¨«á¡A¥¦À³¸Ó·|§ó¦n¡C¦ý²{¦b¤j³¡¥÷ªº¤å¥ó ³£¥Ñ¥L­Ìªº¶}µoªÌ¦Û¦æ¼¶¼g¡C§Ú¨Ã¤£¬O­n§åµû¥L­Ì¡A¦ý¬O¦pªG¤£ÁA¸Ñ¨ä¤¤ªº³N»y¡A ÁÙ¯u¤£ÁA¸Ñ³o¨Ç¤å¥ó¡C

7.1 ¦p¦ó¨ú±o

RedHat ¡B Slackware ¤Î OpenLinux¤¤§Y¤w¸g¦³ Apache¡Cª©¥»¥i¯à¤£¬O³Ì·sªº¡A¦ý ¤G¦ì¤¸Àɵ´¹ï¥i¾a¡C¤£©¯ªº¬O¡A¦UºØª©¥»³£¨Ï¥Î¤£¦Pªº¥Ø¿ý¡C

­ì©lµ{¦¡¥i±q http://www.apache.org/dist/¨ú±o¡C¤G¦ì¤¸ÀÉ¥i±q ftp://sunsite.unc.edu/pub/Linux/apps/www/servers/¨ú±o¡C¨Ï¥Î RedHatªº¤HÁÙ¥i¥H±q ftp://ftp.redhat.com/pub/contrib/i386/¨ú±oRPMÀÉ¡C

¦pªG§Aªº¦øªA¾¹¬O¥Î©ó°Ó·~¥Î³~¡A³Ì¦n¬O±qApacheªººô­¶¤U¸ü­ì©lµ{¦¡¦Û¦æ½sĶ¡C¤] ¥i¥H¨Ï¥Î¦p RedHat¡B Slackware©Î OpenLinux¥»¨Ó´Nªþ±aªº¤G¦ì¤¸ÀÉ¡C¦pªG§A¥Î¨ä¥L°õ ¦æÀÉ¡A¨ä¤¤¥i¯à·|¦³Àb«È°½¥[ªº'«áªù'¡C¤]¥i¯à¦]¬°¤@¨Çpatch¤£°÷¦w©w¡A¦Ó³y¦¨·í¾÷¡C ¦pªG¦Û¦æ½sĶ¡A§AÁÙ¥i¥H´x´¤¹ê»Ú½sĶ¶i¥hªº¼Ò²Õ¡A§A¤]¥i¥H¨M©w­n©ñ¦b¨º¤@­Ó¥Ø¿ý¤¤¡C ½sĶ¨Ã¤£Ãø¡A¦Ó¥B±q½sĶªº¹Lµ{¤¤¡A§AÁÙ¯à¾Ç¨ì¦p¦ó¦¨¬°¯u¥¿ªºLinux¨Ï¥ÎªÌ;)

7.2 ½sĶ¤Î¦w¸Ë

­º¥ý±N¤å¥ó®w¥´¶}¡£untar¡¤¡C©ñ¤J¤@¼È¦s¥Ø¿ý¤¤¡AµM«á¨ìsrc¥Ø¿ý¡C¦p­n¥[¤J¯S®í¼Ò²Õ¡A ´N¦b¦¹­×§ïconfigurationÀɮס£¥­±`¥D­nªº¼Ò²Õ¤w¸g¥[¤J¤F¡¤¡CµM«á°õ¦æ¦¹configuration shell script(./Configure)¡C¶·½T©w¥¦¥¿½T±Ô­z§A¬O¦b¥ÎLinux¥­¥x¡A¦Ó¥B¥H gcc¬°½sĶ¾¹¡C±µ¤U¨Ó¡A§A¥i¥H­×§ïhttp.h¨Ó§ïÅܹw³]ªº¥Ø¿ý¡£©ñconfigÀÉ¡¤¹w³]¬° /usr/local/etc/httpd/¡A§A¥i¯à·|¦Ò¼{²¤Æ¬°/etc/httpd/¡C¦øªA¾¹ ªº®Ú¥Ø¿ý¡£©ñHTML­º­¶¡¤¹w³]¬°/usr/local/etc/httpd/htdocs/¡A§A¤]¥i¯à¦Ò ¼{§ï¬°/home/httpd/html¡£³o­Ó¬ORedHatªº¹w³]¥Ø¿ý¡¤¡C¦pªG§A­n¨Ï¥Îsu-exec ¥Ø¿ý¡£°Ñ¦Ò«á­zªº¦U¶µ¥\¯à²Ó»¡¡¤¡A§A¤]¥i¥H¦Ò¼{²¤Æ¤§¡C¦øªA¾¹ªº¹w³]®Ú¥Ø¿ýÁÙ¥i¥H¥Î configÀɨӧó§ï¡C¦pªGApacheµLªkŪ¨ìconfigÀɮɡAÁÙ¬O¦bhttp.h¤¤©w¸q½sĶ«áªº®Ú¥Ø¿ý ¦ì¸m§a¡C¨ä¥Lªºªº¹w³]¥Ø¿ý³£¥²¶·¥ÎconfigÀɮרӭקï¡C³Ì«á¡A¦b¦¹°õ¦æmakeÀɨӽsĶ Apache¡C

¦pªG¦]¬°¿òº|includeÀɮסA¦Ó¦b½sĶ®É¥X°ÝÃD¡A¤U­±³o¨Ç¶µ¥Ø­È±oÀˬd¤@¤U¡G½T©w¤w¦w¸Ë ¤F¾A¦X§Aªº®Ö¤ß¨t²Îª©¥»ªºKernel header¡£§YincludeÀɮס¤¡C¨ÃÀˬd¤U­zªº³sµ²¬O¥¿½Tªº¡A

/usr/include/linux should be a link to /usr/src/linux/include/linux
/usr/include/asm should be a link to /usr/src/linux/include/asm
/usr/src/linux should be a link to the Linux source directory (ex.linux-2.0.30)
­n³sµ²ÀÉ®×¥i¥Îln -s«ü¥O¡C³o©Mcp«ü¥O¬ÛÃþ¦ü¡A¥u¬O¥¦³sµ²¦Ó¤£¬O½Æ»s ¡£ln -s source-dir destination-link¡¤¡C

¦pªG¦b°õ¦æmake®É¨S¦³°ÝÃD¡A²{¦bªº¥Ø¿ý¤¤À³¦³­Ó¥shttpdªº°õ¦æÀÉ¡C§â¥¦²¾¨ìbin¥Ø¿ý¤¤¡C /usr/sbin©Î/usr/local/sbin³£¥i¡C

¥t¥~±Nconf.¡Blogs¤Î icons¤T­Ó¦¸¥Ø¿ý±qsrc¥Ø¿ý½Æ»s¨ì¦øªA¾¹ªºhome¥Ø¿ý¡CµM«á±Nconf¦¸ ¥Ø¿ý¤¤ªº¤T­ÓÀɮצWºÙ­×§ï¤@¤U¡A®³±¼¨ä¤¤ªº-dist¡A¡£¨Ò¡G±N httpd.conf-dist§ï¦¨/usr/local/sbin¡¤¡C

Apache¤¤ÁÙ¦³¨Ç¤ä´©µ{¦¡¡C¥L­Ì³£¦bsupport¥Ø¿ý¤¤¡A³£­n¦U§O½sĶ¨Ã¦w¸Ë¡C¤j³¡¥÷³o ¨Çµ{¦¡³£¥i¥Î¸Ó¥Ø¿ý¡£§A°õ¦æconfigure script®É¡A¤w½sĶ¦n¤F¡¤¤¤ªºmakefile¨Ó½sĶ¡C §A¨Ï¥ÎApache®É¡A¨Ã¤£¤@©w­n¥Î¨ì³o¨Çµ{¦¡¡A¦ý¨ä¤¤¦³¨Ç¥i¥H²¤Æ¨t²ÎºÞ²z­ûªº¤u§@¡C

7.3 ³]©w

¦¹®É¦bconf¦¸¥Ø¿ý¤¤¡A§AÀ³¸Ó·|¦³¥|­ÓÀɮסC¨ä¤¤¡Ahttpd.conf¥Î¨Ó³]©w¦øªA¾¹ ¦uÅ@¯«¡£port¸¹½X¡B¨Ï¥ÎªÌµ¥¡E¡E¡¤¡Csrm.conf¥Î¨Ó³]©wroot documen tree¡B special handleµ¥¡C¦Óaccess.conf¥Î¨Ó³]©w°ò¥»¦s¨ú¡C³Ì«á¡Amine.types¥Î¨Ó§i ¶D¦øªA¾¹¡A¨º¤@­Ó©µ¦ùÀɮצW¥Nªí°eµ¹ÂsÄý¾¹¨º¤@ºØmine«¬¦¡¡C

¤@¥¹ÁA¸Ñ¨ä¤¤©Ç³N»y¡A§A´N·|µo²{³o¨Ç³]©wÀɤ¤¦³³\¦hªþ±a»¡©ú¡C¦b§A±Ò¥Î¦øªA¾¹¤§«e¡A¹ý ¹ý©³©³±oŪ¥¦¤@¹M¡C¨ä¤¤ªº¨C¤@­Ó¶µ¥Ø¦bApache¤å¥ó¤¤³£¦³»¡©ú¡C

mine.typesÀɮר䣬O¯u¥¿ªº³]©wÀÉ¡C¦øªA¾¹¦b°e¸ê®Æµ¹ÂsÄý¾¹¤§«e¡A±N©µ¦ùÀɮצWĶ ¬°mine«¬¦¡¡C¤@¯ëªº mine«¬¦¡³£¤w¦b¦¹Àɮפ¤¤F¡A¤j¦h±¡ªp¤U¤£¶·­×§ï¦¹¤@ÀɮסC¥¼¨Ó¤@¨Ç ¤é¤l¥H«á¡A¦³¤@¨Ç·sªºmine«¬¦¡¶}µo¥X¨Ó¥H«á¡A¦¹®É¤~¯u¥¿­n­×§ï³o¤@ÀɮסC

°OµÛ¤@ÂI¡I¨C·í§A§ïÅܤF³]©wÀÉ¡A´N¶·­«·s±Ò°ÊApache¡C¤£µM¤]­n¥Îkill°e¤@­ÓSIGNUP °T¸¹¡A¨Ó±Ò°Ê·sªº³]©w¡C³o­Ó°T¸¹¬O­n°e¨ì¤÷µ{¦¡¦Ó¤£¬O¤lµ{¦¡¡C­n¬d¥X¤÷µ{¦¡ªº¥N¸¹¦³¨Ç ¤èªk¡A¤÷µ{¦¡ªº¥N¸¹¤@¯ë¸û¤p¡C¤÷µ{¦¡ªº¥N¸¹¤]¥i±qlog¦¸¥Ø¿ýªºhttpd.pidÀɮפ¤¬d¨ì¡C ¦Ó¥B¦pªG§A°ekillµ¹¤lµ{¦¡¡A¤lµ{¦¡¦º¤F¡A¦Ó¤÷µ{¦¡¤S·|¥ß¨è²£¥Í¤@­Ó¤lµ{¦¡¡C

§Ú¤£·Q±aµÛ§A¤@¨B¤@¨B¦a¥h³]©wApache¡C§Ú·Q°w¹ï¤@¨Ç¯S®íªº®×¨Ò¡B¿ï¶µ¤Î¥\¯à¥[¥H»¡©ú¡C ±j¯P«Øij¦n¦nŪ¤@ŪApache¤å¥ó¤¤ªº«O¥þ³Z¬¡C¥¦¥i¥H±q http://www.apache.org/docs/mics/security_tips.html¤U¸ü¡C

7.4 «Ø¥ßµêÀÀºô¯¸¥D¾÷

µêÀÀ¥D¾÷¥Î©ó¤@¥x¹q¸£¾Ö¦³¼Æ­Óºô°ì¦WºÙªº±¡ªp¡C¦Ñªº¤èªk¬Oµ¹¨C¤@µêÀÀ¥D¾÷¤@­Ó±M¥Îªº IP¦ì§}¡C·sªº¤èªk¥u¥Î¤@­Ó¦@¥ÎªºIP¦ì§}¡A¦ý¬O¦pªGÂsÄý¾¹¤£¤ä´©HTTP 1.1«h¨S¦³¥Î¡C

§Ú«Øij¡A¦pªG¬O¥Î¦b°Ó·~¤W¡A¥ý¥Î¦Ñ¤èªk¡Aª½¨ì¤H¤HªºÂsÄý¾¹³£¤ä´©HTTP 1.1®É¡A¦A§ï¥Î ·s¤èªk¡C¦Ó¥B¦Ñ¤èªkªº»¡©ú¤]¸û¦h¡C¨âºØ¤èªk³£¦³µêÀÀmail¥\¯à¡£³o¹ï¶Ü¡H¡¤¡A¦ý¥u¦³¦Ñ ¤èªk¤~¦³µêÀÀFTP¥\¯à¡C

¦pªG¥Î¦b¤p²Õ´©Î­Ó¤Hºô­¶¡A§A¥i¦Ò¼{·sªº¤èªk¡C¥¦¥i¥H¬Ù¥h§A©ù¶QªºIP¦ì§}¡C

§AÁÙ¥i¥H¦b¦P¤@¦øªA¾¹²V¦X¨âºØ¤èªk¡C¬ÛÃö²Ó¸`°Ñ¦ÒApacheweek¡G http://www.apacheweek.com/features/vhost¡C

±M¥ÎIP¦ì§}¡£IP based¡¤µêÀÀ¥D¾÷

¥H¦¹¤@¤èªk¡A¨C¤@µêÀÀ¥D¾÷¦U¦³¤@­ÓIP¦ì§}¡C¨Ï¥Î¨C¤@½Ð¨D¡£request¡¤©Ò°e©¹¤§IP¦ì§} ¡AApache¤Î¨ä¥Lµ{¦¡¡A¨M©w­n¥Î¨º¤@­Óºô°ì¨Ó§¹¦¨ªA°È¡C³o­Ó¨BÆJ«D±`®ö¶OIPªÅ¶¡¡C¥H §ÚªºµêÀÀºô°ì©Ò¦bªº¦øªA¾¹¨ÓÁ|¨Ò¡A¥L­Ì³£¦³35,000­ÓµêÀÀ±b¸¹¡A¤]´N¬O35,000­ÓIP¦ì§} ¡A¦ý§Ú¬Û«H¥u¦³¤£¨ì50­Ó¦øªA¾¹¬O¯u¥¿¦b¹B§@¡C

³]©w³oºØµêÀÀ¥D¾÷¦³¨â¤j¨BÆJ¡A²Ä¤@¬O³]©wLinux¡A¨Ï¥¦¯à±µ¨ü¨â­Ó¥H¤WªºIP¦ì§}¡C¨ä¦¸ ¡A¬O³]©wApache¨Ï¥¦¤ä´©µêÀÀ¥D¾÷¥\¯à¡C

²Ä¤@¨BÆJ¡A³]©wLinux¡A¨Ï¥¦±µ¨ü¼Æ­ÓIP¦ì§}¡A³o­n«Ø¥ß¤@­Ó·sªº®Ö¤ß¨t²Î¡A´N¬O¨Ï¥¦¤ä ´©IP networking ¤ÎIP aliasing¡C¡£¦b2.0ª©¤Î¨ä«áªºª©¥»¡A³o¨BÆJ¸û®e©ö¡¤¡C½sĶ®Ö ¤ßªº»¡©ú¡A°Ñ¦Ò kernel howto¡C

²Ä¤G¨BÆJ¡A­n³]©w¶}¾÷µ{§Ç¤¤ªº¤¶­±¡C¦pªG§A¥Îªº¬ORed Hat¡A¥i¥Î±±¨î¥x¨Ó³]©w¡C¥Î root¥´¶}X-Windows¡A§AÀ³¸Ó¥i¥H¬Ý¨ì±±¨î¥x¡CÂùÀºNetwork configuration¡AÂI¿ï interface panel¨Ã¿ï¾Ü§AªºNetwork card¡CÂI¿ï©³¤Uªºalias¡A¶ñ¤J¸ê®Æ¡AµM«áÂI¿ïdone¡C ¨C¤@µêÀÀ¥D¾÷³£­n¤@¤@³]©w¡C

¦pªG§A¤£¬O¥ÎRed Hat¡A§A´N­n¥Î¤â°Ê¤è¦¡¨Ó³]©w¡A¦b/etc/rc.d¥Ø¿ý¤¤ªº rc.localÀɮפ¤¥[¤J«ü¥O¡C¨C¤@³]¬I³£­n¦³­Óifconfig¤Îroute«ü¥O¡C ¦P¦W³]¬I¬°¤@¥D­n³]¬Iªº¦¸³]¬I¡C¨Ò¦p¡Geth0¡G1 ¡Beth0¡G2µ¥¡C¤U­z¬°³]©w¤@¦P¦W³]¬Iªº ¨Ò¤l¡G

ifconfig eth0:0 192.168.1.57
route add -host 192.168.1.57 dev eth0:0

ÁÙ¥i¥H¦bifconfig©R¥O¤¤¥[¤Jbroadcast address¤Înetmask¡C¦pªG¦³³\¦h¦P¦W¦a§}¡A¥i¥H¥Î for loop¨Ó²¤Æ©R¥OÀÉ¡C

¬ÛÃö²Ó¸`°Ñ¦Ò IP alias mini howto¡C

±µ¤U¨Ó´N¬O³]©wºô°ì¦WºÙ¦øªA¾¹¡£DNS¡¤¨Ó¬d¸ß³o¨Ç·sªººô°ì¡C¦pªG§A¨S¦³§Aªººô°ì¦WºÙ ¡A¥i¨ì Internicµù¥U¡C¥i°Ñ¦ÒDNS-HOWTO¨Ó ³]©w§AªºDNS¡C

³Ì«á­n³]©wApache¨ÓÅý³o¨ÇµêÀÀºô°ì¥¿±`¤u§@¡C¨Ï¥Îhttpd.conf³]©wÀÉ¡C¨ä¤¤¦³­Ó¨Ò ¤l¡A¥i¥H°Ñ¦Ò¡C©Ò¦³ªº«ü¥O³£©ñ¦bvirtualhost«ü¥O¼Ðñ¤§¤º¡A¥ô¦ó«ü¥O³£¥i©ñ¤J¡C¤@ ¯ë¨Ó»¡¡A­n³]©w¦U§Oªº®Ú¥Ø¿ý¡Ascript¥Ø¿ý¤ÎlogÀɮץؿý¡A¥u­n¥[¤Jvirtualhost¼Ðñ ¡A´N¥i¥H¤£Â_¥[¤J·sªºµêÀÀ¥D¾÷¡C

¦b¤@¨Ç·¥¯S®íªº±¡ªp¤U¡A¦pªG¬Y¤@­ÓµêÀÀ¥D¾÷»Ý­n¨Ï¥Î¬Y¤@«ü¥O¡A¦ý¤£©¯¥¦¤S¤£¯à©ñ¤Jµê ÀÀ¥D¾÷ªº¼Ðñ¤¤¡A¨º´N¥u¦n¨Ï¥Î¤£¦P¦øªA¾¹¡CBindaddress«ü¥O§Y¬°¤@¨Ò¡C¨C¤@­Ó¦øªA¾¹³£ ­n¦³¤£¦Pªº¦WºÙ¤Î³]©wÀÉ¡C¨C¤@¦øªA¾¹¥u­t³d¤@­Ó¥ÑBindaddress«ü¥O©Ò«ü©wªº¦ì§}¡Cµ²ªG ¨t²Î¸ê·½´N³Q¤j¤jªº®ö¶O±¼¤F¡C

¦@¥ÎIP¦ì§}µêÀÀ¥D¾÷

¦¹¬°«Ø¥ßµêÀÀ¥D¾÷ªº·s¤èªk¡C³æ¤@IP¦ì§}³Q±Ä¥Î¡A¦]¦ÓIP¦ì§}¬O¥Î¦b¯u¹ê¾÷¾¹¤W¡£¦Ó«Dµê ÀÀ¥D¾÷¡¤¡C¦b¤W­z¨Ò¤l¤¤¡A30,000­ÓµêÀÀ¥D¾÷¥u·|¥Î±¼50­ÓIP¦ì§}¡£¨C¥x¾÷¾¹¤@­Ó¡¤¡C³o ­n·f°tHTTP1.1¨óij¡AÂsÄý¾¹¦b°e¥X½Ð¨D®É¡A³qª¾¦øªA¾¹¥¦­n±µ¨ì¨º­Óºô¯¸¡C¦pªGÂsÄý¾¹ µLªk¤ä´©HTTP1.1¡A´N·|¥hŪ¦øªA¾¹ªº­º­¶¡A¨ä¤¤À³¦³¿ï³æ¨Ñ¿ï¾Ü­n¨Ï¥ÎªºµêÀÀ¥D¾÷¡C³o¼Ë ¤l¡A­ì¨Ó§A¥H¬°§A¾Ö¦³¦Û¤vªº¦øªA¾¹ªº¨ººØ·Pı¡A´N·|³Q¯}Ãa¤F¡C

³]©w¨BÆJ¤ñ©T©wIP¦ì§}ªº¤è¦¡®e©ö¡C§A¤´µM­n±qIntenicµù¥U§Aªººô°ì¦WºÙ¡AµM«á³]©wºô °ì¦WºÙ¦øªA¾¹¡C¦ý¬Oºô°ì¦WºÙ¦øªA¾¹«o¬O­n«ü¨ì­ì¨Óºô°ì¦WºÙªºIP¦ì§}¡CApacheªº³]©w¤è ¦¡¤´µM¤£ÅÜ¡C¦]¬°§A¦bvirtualhost¼Ðñ¤º¨Ï¥Î¬Û¦PIP¦ì§}¡AApache´Nª¾¹D§AªºµêÀÀ¥D¾÷ ­n¦@¥ÎIP¦ì§}¡C

°w¹ï¦Ñ¦¡ªºÂsÄý¾¹«h¦³´XºØ½Õ¾ã¤u§@­n°µ¡A§Ú¥u¤¶²Ð¨ä¤¤³Ì¨ÎªÌ¡C­º¥ý¶·±N§Aªº­º­¶¥Ø¿ý ³]¬°¤@­ÓµêÀÀ¥D¾÷¡£©T©wIP©Î¦@¥ÎIP¦ì§}¡¤¡C³o¼Ë¤l§Aªº­º­¶¥Ø¿ý´N¥i¥HÄË¥X¨Ó¥Î©ó³s±µ ¨ì¦U­ÓµêÀÀ¥D¾÷¤W¥h¡CµM«á´N¬O¬°¦Ñ¦¡ÂsÄý¾¹¶}¤@­Ó'«áªù'¡C§@ªk¬O¥ÎServerPath «ü¥O¡A¬°¨C¤@­Óvirtualhost¼Ðñ¤ºªºµêÀÀ¥D¾÷©w¸q¸ô®|¡C¨Ò¦p¡A¦bwww.mysite.com ¤¤¥[¤@­ÓServerPath /mysite/¡A¦ÑªºÂsÄý¾¹´N¥i¥H¥Îwww.mysite.com/mysite/ ¦s¨ú¸Ó¥D¾÷ªº¸ê®Æ¡CµM«á¦b­º­¶¥Ø¿ý©ñ¤J¤@¹w³]­º­¶¡A¨ä¤¤¦n¦n¦aÄU¨Ï¥ÎªÌ§ï¥Î·sªºÂsÄý ¾¹¡A¨Ã¥B±ø¦C¸Ó¥D¾÷¤W¦U­Óºô¯¸ªº'«áªù'¡C¦p¦¹¤@¥¹¤@­Ó¦Ñ¦¡ÂsÄý¾¹Åª¨ì¦¹¯¸¡A´N·|Å㠥ܤ@­Ó­º­¶¡A§iª¾¦p¦ó³s¨ì¥¿½Tªººô­¶¡C¦Ó·s¦¡ÂsÄý¾¹«h¥iª½±µ³s¨ì¥¿½Tªººô­¶¡CÁÙ­nª` ·N¤@¥ó¨Æ¡A§Y§Aªº­º­¶¤¤ªº³sµ²¥²¶·©w¸q²M·¡¡C¦]¬°¨C¤@­¶³£¥i¥H¥H¨â­Ó¤£¦PªºURL¨Ó³sµ² ¡£¨Ò¦p¡Gwww.mysite.com©Mwww.mysite.com/mysite/¡¤¡C

§Æ±æ¨ì¦¹¬°¤î¡A§AÁÙ¯à«O«ùÀY¸£²M´·¡A²×¨s¤W­zªº¤º®e¨Ã¤£®e©ö·d²M·¡¡C·d¤£¦n¡A§A³Ì«á ÁÙ¬O¨M©w¨Ï¥Î±M¥ÎIP¦ì§}¡C ¬ÛÃö¸ê®Æ¥i¥H±qApacheºô¯¸¨ú±o http://www.apache.org/manual/host.html¡C

¦pªG¦³¤H¦³Ãö©ó¦@¥ÎIP¦ì§}ªº¸ê®Æ¡A½Ð§i¶D§Ú¡C§Ú·Qª¾¹D¨ì©³¦³¦h¤ÖÂsÄý¾¹¥i¤ä´© HTTP 1.1¡C¦p¦³¤@¥÷²M³æ¦C¥X¥L­Ìªºª©¥»´N§ó¦n¡C

7.5 CGI scripts

¦³¨âºØ¤è¦¡Åý§Aªººô¯¸¥Î¤á¹B¥ÎCGI script¥\¯à¡C²Ä¤@ºØ¤è¦¡¬O¡A¥u­n¬OCGI script¡A¨ä ©µ¦ùÀɦW§Y¬°.cgi¡C¥t¤@ºØ¤è¦¡¬O«Ø¥ß¤@script¦¸¥Ø¿ý¡£³q±`¥scgi-bin¡¤¡C ¨âºØ¤è¦¡¤]¥i¨Ã¥Î¡C¤£½×¨Ï¥Î¨º¤@ºØ¤è¦¡¡A§Aªºscript¥²¶·³]¦¨¥i°õ¦æ¼Ò¦¡ ¡£chmod 711¡¤¡C¦ý¬OÅý¥Î¤á¨Ï¥Îscript¦s¨ú¥i¯à·|¦³«O¥þªº­·ÀI¡A©Ò¥H¥ý­n²Ó¤ßªº ¬ã¨s¡C

§Ú­Ó¤H¤ñ¸û³ßÅw¨Ï¥Î²Ä¤@ºØ¤è¦¡¡A¤×¨ä¬O·íscript«Ü½ÆÂø®É¡C³oºØ¤è¦¡¤¹³\§âscript©ñ¦b ¥ô¦ó¥Ø¿ý¤¤¡C§Ú­Ó¤H³ß·R±Nscript©ñ¤J¬ÛÃö­º­¶¥Ø¿ý¤¤¡C¦pªG¤@­Óºô¯¸¦³³\³\¦h¦hªºscript ¡A¨º»ò±N¥L­Ì¤À´²¦w¸m¤ñ¶°¤¤¦b¤@­Ó¥Ø¿ý¤¤­n®e©ö¬Ý±o¦h¤F¡C¦Ó¥B³]©w¤]¤ñ¸û²³æ¡C­º¥ý ¦bsrm.confÀÉ«á­±¶}±Ò¡£uncomment¡¤.cgi¼Ð¦¡¡AµM«áÀˬd¬O§_¨C¤@¥Ø¿ýªº access.confÀɤ¤³£¦³option ExecCGI©ÎAll¡C

«Ø¥ßscript¦¸¥Ø¿ý«h¸û¬°«O¥þ¡C§@ªk¬O¦bsrm.confÀɤ¤¨Ï¥ÎscriptAlias«ü¥O¡C²Ä¤@ ­Ó°Ñ¼Æ¬O¥N¦W¡£Alias¡¤,²Ä¤G­Ó°Ñ¼Æ¬O¯u¹ê¥Ø¿ý¡C¨Ò¦p«ü¥O ScriptAlias /cgi-bin/ /usr/httpd/cgi-bin/©w¸q: ·í©I¥s¥Ø¿ý/cgi-bin/®É¡A¯u¥¿ªºscript¬O¦b/usr/httpd/cgi-bin/¤¤°õ¦æ¡C ¬°¤F«O¥þªº²z¥Ñ¡A¦baccess.confÀɤ¤³]©w¸Ó¥Ø¿ýªº¯S©Ê¬° Options none¡AAllowOveride none¡£¥u­n¶}±Ò¡£uncomment¡¤¸Ó¦æ§Y¥i¡¤¡C¦ý­nª`·N ¡A¤£­n§â¥¦³]¬°¥ô¦ó­º­¶ªº¦¸¥Ø¿ý¡C¨Ò¦p»¡¡A¦pªG§Aªº­º­¶¥Ø¿ý¬° /home/httpd/html/¡A¤£­n³]¬°/home/httpd/html/cgi-bin¡A¦ý¥i¥H³]¬° /home/httpd/cgi-bin¡C

¦pªG­n¤¹³\¥Î¤á¦³¦Û¤vªºscript¦¸¥Ø¿ý¡A¥i¥H¨Ï¥Î¼Æ­ÓScriptAlias©R¥O¡C¦pªG¨Ï¥Îµê ÀÀ¥D¾÷¡A«h¦bvirtualhost¼Ðñ¤º©ñ¤JScriptAlias©R¥O¡C¦³¤H¥i¥H§i¶D§Ú¤£¶·­n ¤@¤@¥[¤JScriptAlias©R¥Oªº¤èªk¶Ü¡H

7.6 ¨Ï¥ÎªÌºô­¶¥Ø¿ý

¦³¨âºØ¤£¦P¤è¦¡¨Ó³]©w¨Ï¥ÎªÌªººô­¶¥Ø¿ý¡C²Ä¤@­Ó¤èªk¬O¦b¨Ï¥ÎªÌªººô­¶¥Ø¿ý¤U«Ø¥ß¤@­Ó ­Ó§Oªº¦¸¥Ø¿ý¡C¡£¤@¯ë¬°public_html¡¤¡C²Ä¤G­Ó¤èªk¬O¡A¥t¥~¬°¨C¤@­Óºô­¶¥Ø¿ý«Ø ¥ß¤@­Ó¥Ø¿ý¾ð¡A¨âºØ¤èªk³£¶·¦baccess.confÀɤ¤³]©w¦s¨ú¿ï¶µ¡C

²Ä¤@­Ó¤èªk¬OApache¹w³]ªº¤è¦¡¡C³oºØ¤èªk¬O¡A·í­nŪ/~bob/ªººô­¶¡AApacheŪ public_html¥Ø¿ý¤¤bobªº­º­¶¥Ø¿ý¡C§@ªk¬O¦bsrm.confÀɤ¤¥ÎUserDir«ü¥O ¨Ó³]©w¡C¸Ó¥Ø¿ý¥²¶·¬Oworld¥iŪ¨ú¤Îworld¥i°õ¦æ¡C¦]¬°­nApache¨ÓŪ¨ú¨Ï¥ÎªÌªº¥Ø¿ý¡A¸Ó ¥Ø¿ý¥²¶·¬°world¥i°õ¦æ¡A©Ò¥H·|²£¥Í¤@¨Ç«O¥þªº­·ÀI¡C

²Ä¤GºØ¤èªk«h¸û®e©ö³]©w¡C¥u¦³srm.confÀɤ¤ªºUserDir«ü¥O»Ý­n³Q ­×§ï¡C®æ¦¡¦³«Ü¦hºØ¡A½Ð°Ñ¦ÒApacheªº¤å¥ó¡A§Ë²M·¡¦UºØ©w¸q¡C¦pªG·QÅý¨C£¸¨Ï¥ÎªÌ¦b¥Ø ¿ý/home/httpd/¤U¡A¦³¦Û¤vªº¥Ø¿ý¡A´N­n¨Ï¥Î«ü¥OUserDir /home/httpd¡C ¨º»ò·í/~bob/³QŪ¨ú®É¡AŪ¨úªº¥Ø¿ý´N·|Åܬ°/home/httpd/bob/¡C­Y ¬O­nÅýbobªº¥Ø¿ý¤U¥t¥[¤@­Ó¦¸¥Ø¿ý°µ¬°¥Lªº­º­¶¥Ø¿ý¡A´N¥Î UserDir /home/httpd/*/html«ü¥O¡CŪ¨úªº¥Ø¿ý´NÅܦ¨ /home/httpd/bob/html/¡A¦P®É¤]«Ø¥ß¤@­Óscript¥Ø¿ý¡£¨Ò¦p¡G /home/httpd/bob/cgi-bin/¡¤¡C

7.7 Daemon¼Ò¦¡»PInetd¼Ò¦¡

Apache¥i¦b¤U­z¨âºØ¼Ò¦¡¤U¹B§@¡C¨ä¤@¬°daemon¼Ò¦¡¡A¦b³o­Ó¼Ò¦¡¤UApache¤£°±¹B§@¡£ ApacheºÙ¤§¬° standalong¡¤¡C¥t¤@¬°inetd super-server¡C

daemon¼Ò¦¡¤ñinetd¼Ò¦¡¦n¡CApache¥H¥¦¬°¹w³]¼Ò¦¡¡C¨Ï¥Îinetd¼Ò¦¡ªº°ß¤@±¡ªp¬O¡A·í¨Ï¥Î ²v«Ü§C®É¡A¨Ò¦p¤º³¡´ú¸Õscript¡B¤p«¬¥ø·~ªº°Ï°ìºô¸ôµ¥¡E¡E¡E¡CInetd¼Ò¦¡¥i¸`¬Ù°O¾ÐÅé ªÅ¶¡¡A¦]¬°Apache¥u¦³·í¥²­n®É¤~¶}±Ò¡A¥­±`°O¾ÐÅ餤¥u¦³inetd daemon¡C

¦pªG§A¤£±`¨Ï¥ÎApache¡A¥i¥H¦Ò¼{Åý¥¦ºû«ù¦bdaemon¼Ò¦¡¡A¦Ó¥B¥u¦³¥²­n®É¤~±Ò°ÊApache¡C ¨º»ò§A¤£¦A»Ý­n®É¡A¥i¥H±þ±¼Apache¡£­n±þªº¬O¤÷µ{¦¡§Ç¦Ó¤£¬O¤lµ{§Ç¡¤¡C

­n³]©wInetd¼Ò¦¡¡A¦³¤@¨ÇÀÉ­n­×§ï¡C­º¥ý¬d¤@¤U/etc/servicesÀɮסA¬Ý¤@¬Ý http¬O§_¦s¦b¡A¦pªG¤£¦b¡A«h¥H¤U¦C¤è¦¡¥[¤J

http    80/tcp

¦bPort 79 ¡£finger¡¤ªº«á­±¤]³\­È±o¦Ò¼{¡CµM«á­×§ï/etc/inetd.confÀɮסA ¥[¤J

http    stream  tcp     nowait  root    /usr/sbin/httpd httpd

¦pªGApache¦b¤£¦P¦ì¸m¡A¸ô®|­nÀHApacheªº¥Ø¿ý¨Ó§ïÅÜ¡C²Ä¤G­Óhttp¤£¬Otypo¡A¥¦¥u¬O inetd daemonªº»Ý¨D¡C¦pªG§A¤£¦A¨Ï¥Îinetd daemon¡A¨º´N§âÀɮפ¤§A¤£·Q±Ò°ÊªºªA°È§ï¬° µù¸Ñ¦æ¡£¹³FTP¡B finger¡B telnet¤Î¨ä¥L±`¥Î©óinetd daemonªºªA°È¶µ¥Ø¡¤¡C

¦pªG§A¦b¥Îinetd daemon,¥u­nµ¹¥¦¤@­ÓSIGHUP°T¸¹¡£¥Îkill©R¥O¡A°Ñ¦Òkillªºman page¡¤ ©Î­«·s±Ò°Ê¨t²ÎÅý­×§ï¶µ¥Ø¥Í®Ä¡C¦pªGinetd¤£¦b¨Ï¥Î¡A¥i¥H¥H¤â°Ê¤è¦¡±Ò°Êªº¡C ¤]¥i¥H¥[¦binitÀɮס£¤]³\¬Orc.localÀÉ¡¤¤¤¡A¨Ï±o¶}¾÷®ÉInetd¦Û°Ê±Ò°Ê¡C

7.8 ¶}©ñPut¤Îdelete©R¥O

·sªººô­¶µo¦æ¤u¨ã¤ä´©¥Hhttp¤W¸üºô­¶¡£¦Ó¤£­­©ó¥ÎFTP¡¤¡C¨ä¤¤¦³ªº¬Æ¦ÜÁÙ¤£¤ä´©FTP ¤W¸ü¡CApache¤]¤ä´©http¤W¸ü¡A¦ý©Ò­n¥Îªºscript«h¨S¦³¥]§t¡A¦]¦Ó¤W¸ü©Ò¥Îªºscript ¥i¯à¦¨¬°«O¥þªº¤jº|¬}¡C¦b¼g©Î¥Î§O¤Hªºscript«e¡A½Ð¥ý·d²M·¡ª¬ªp¡C

¦pªG¦³¤Hª¾¹D¥ô¦ó¦¹Ãþªºscript¡A½Ð§i¶D§Ú¡C§Ú·|§â¥¦ªººô§}¯Ç¤J¡C

¬ÛÃö²Ó¸`°Ñ¦Ò Apacheweek http://www.apacheweek.com/features/put¡C

7.9 ¨Ï¥ÎAuthentication/Access Control

³o¬O§Ú³Ì³ß·Rªº¤@­Ó¥\¯à¡C¥¦Åý§A¤£¶·­n¥Î¨ìCGI script´N¥i¥H«OÅ@¥Ø¿ý©ÎÀɮסC¥¦ÁÙ ¥i¥H¨Ì¾Ú¥Î¤áªºIP¦ì§}©Îºô°ì¦WºÙ¨Ó¨M©w¥Î¤áªº¦s¨úÅv¡C³o¬O¤@ºØ§â¤£³t¤§«È­ç¥X¥Î¤á¦W ³æªº¦n¤èªk¡£¥u­n±qlogÀɮ׬d¥X¥¦­ÌªºIP¦ì§}¤Îºô°ì¦WºÙ§Y¥i¡¤¡C

­n³]©w Authentication¡A¥Ø¿ý¤¤access.confÀɮפ¤¥²¶·­n¦³ AllowOverrides Authconfig¡C¦Ó³]©waccess control¡£¨Ï¥Îºô°ì¦WºÙ©ÎIP ¦ì§}¡¤¡A«h¥[¤JAllowOverrides Limit¡C

³]©w¥Ø¿ý¡A´N­n¦b¨ä¤¤©ñ¤J.htaccessÀɮסC­n³]©w¨Ï¥ÎªÌªºAuthentication¡A ­n¥Î¨ì.htpasswdÀÉ©Î¥~±a¤@.htgroupÀÉ¡C³o¨â­ÓÀÉÁÙ¥i¥Ñ¼Æ­Ó .htaccessÀɦ@¥Î¡C

¬°¤F«O¥þªº²z¥Ñ¡A§Ú­Ó¤H«Øij¡A¨C­Ó¨Ï¥ÎªÌ³£¦b¥L­Ìªºaccess.confÀɨϥΤU­z«ü¥O¡G

<files ~ "/\.ht">
order deny,allow
deny from all
</files>

¦pªG§A¤£¬O¨t²ÎºÞ²z­û¡A¦ý§Aªº¥Ø¿ý¤w¸g³]¬°AllowOverride Limit¡A§A¤´µM¥i¥H¦b §Aªº .htaccessÀɮפ¤¥[¤J³o¨Ç«ü¥O¡C¥L­Ì¥i¥H¨¾¤î§O¤H°½¿s§Aªºaccess control Àɮס£.htaccess ¡B.htpasswdµ¥¡¤¡C

Access control¥i¹B¥Î¦b³\¦h¤£¦Pªº¿ï¶µ¤ÎÀɮ׫¬¦¡¡C³o¤w¶W¥X¥»¤åªº½dÃ¥¡C³]©w¨Ï¥Î ªÌ Authenticationªº¸ê°T¡A½Ð°Ñ¦Ò http://www.apacheweek.com/features/userauth¡A©ÎNCSAªººô­¶ at http://hoohoo.ncsa.uiuc.edu/docs-1.5/tutorials/user.html¡C

7.10 su-exec

su-exec¥\¯à¯à¥Hownerªº¦a¦ì°õ¦æCGI script¡C¥­±`³£¥Hºô­¶¦øªA¾¹¡£¤£¬O¤@¯ëªº¤H¡¤ ªº¦a¦ì¨Ó°õ¦æCGI script¡C¦]¦¹¡A¨Ï¥ÎªÌ¤£¶·±N¥L­ÌªºCGI scriptªº¦s¨ú¼Ò¦¡³]¬°world writable¡£³o¬O¤@­Óº|¬}¡¤¡C¦ý¬O¦pªG¤£¼ô±xsu-exec¡A§A¥i¯à·|·d¥X§ó¤jªºº|¬}¡C¥­±` su-exec¦b°õ¦æ«e·|§@«O¥þÀˬd¡A¦ý¦pªG³]©w¿ù»~¡A¤Ï¦Ó²£¥Í«O¥þªºº|¬}¡C

su-exec¤£¬O³]­pµ¹¥~¦æ¤H¥Îªº¡C¦pªG¨S¦³·d²M·¡¡A³Ì¦n¤£­n¥Î¡A¤£µM§A·d¥X¨Óªºº|¬} ¥i¥HÅý¨Ï¥ÎªÌ¨ã³Æroot¦s¨ú¯à¤O¡CµL½×¦p¦ó¤£­n­×§ïµ{¦¡¡A­nŪ³q©Ò¦³¬ÛÃö¤å¥ó¡C su-exec¨º»òÃø³]©w¡A¬O¬G·N³]­p¥X¨ÓÅý¥~¦æ¤Hª¾Ãø¦Ó°h¡£¥þ³¡¤â°Ê¾Þ§@¡A¨S¦³makeÀÉ ¡A¤]¨S¦³¦w¸Ëscript¡¤¡C

su-exec¬O©ñ¦bsupport¥Ø¿ý¤¤¡C­º¥ý­n¬°¨t²Î­×§ïsuexec.hÀÉ¡AµM«á¥Î¤U­±ªº ©R¥O½sĶsu-execµ{¦¡

gcc suexec.c -o suexec

µM«á±Nsu-execªº¥i°õ¦æÀɽƻs¨ì¾A·íªº¥Ø¿ý¡CApacheªº¹w³]¥Ø¿ý¬° /usr/local/etc/httpd/sbin/¡C¦p­n§ïÅܹw³]¥Ø¿ý¡A¥i­×§ïApache­ì©lµ{¦¡¤¤ ªºhttph¡A¦b­«·s½sĶApache¡CApache¥u·|·j´M¸Ó¥Ø¿ý¡A¦Ó¤£·|·j´M¸ô®|¡C¥t¥~­n §âsu-execªº¨Ï¥ÎªÌ§ï¬°root(chown root suexec)¡A¨Ã¥B³]©wsuid bit (chmod 4711 suexec)¡C³Ì«á­«·s±Ò°ÊApache¡C¦¹®ÉApacheÀ³¸Ó·|¦b¿Ã¹õ¤WÅã¥Ü su-exec¥¿¦b¹B§@¡C

CGI script¤´­n³]¬°world executable¡C¥L­Ì¥i¥H¥HCGI script ownerªº¨­¥÷°õ¦æ¡C¦pªG ³]©w¥L­ÌªºSUID¡£set user id¡¤bit¡A«h¤£·|°õ¦æ¡C¦pªG¥L­Ìªº¥Ø¿ý¬°world©Î group writable¡A¤]¤£·|°õ¦æ¡C¦pªGowner¬°system user ¡£root¡Bbinµ¥¡¤¤]¤£·|°õ¦æ¡C ¬ÛÃö«O¥þª¬ªp¡A°Ñ¦Òsu-execªº¤å¥ó¡C¦pªGÁÙ¦³°ÝÃD¡AÀˬdsu-execªºlogÀÉcgi.log¡C

¦bApacheªºinetd¼Ò¦¡¡Asu-exec¤£¹B§@¡A¥u¦³¦bdaemon¼Ò¦¡¤~¹B§@¡C¤U¤@ª©¥i¯à·|§ïµ½ ¡A¦]¬°inetd¼Ò¦¡¤£·|¦A¥Î¨ì¤F¡C­nª±­ì©lµ{¦¡ªº¸Ü¡A´N­×§ïhttp.main.c¡C§A¥i¥H§R°£ ¨ä¤¤¨Ï¥Îsu-exec wrapperªºApache«Å§i¡£¥¦¦b¨C­Ó¿é¥X¤§«e©~µM³£¦L¤@¦¸¡¤¡C

¦n¦nŪ¤@¤UApache¦³Ãösu-execªº¤å¥ó¡C¥L­Ì©Msu-execªº­ì©lµ{¦¡³£¦bApacheºô¯¸¤¤ http://www.apache.org/docs/suexec.html¡C

7.11 Imagemaps

Apache¯à¥Î¨Ó³B²z¦øªA¾¹ºÝimagemaps¡CImagemaps¬Oºô¯¸¤Wªº¹Ï§Î¡A¨Ï¥ÎªÌÂI¿ï¹Ï§Î¤¤ ¬Y­Ó¦ì¸m¡A¥i¥H¥Î¨Ó¨M©w­n³sµ²¨ì¨ºùØ¥h¡C­n±Ò°Êimagemaps¡A¥ý½T©wimagemap¼Ò¦¡¬O§_ ¤w¦w¸Ë¡£¥¦¬O¹w³]­n¦w¸Ëªº¤@­Ó¼Ò¦¡¡¤¡CµM«á±Nsrm.confÀɤ¤ªº.map ¼Ð°O ¶}±Ò¡£uncomment¡¤¡C¦¹®É©Ò¦³¥H.mapµ²§ÀªºÀɮ׳£Åܦ¨¤FimagemapÀɮסC ImagemapÀɥΤ@­Ó¹Ï§Îªº¦U­Ó¦ì¸m³sµ²¨ì¤£¦Pªººô­¶¡CApache¥H¼Ð·ÇNCSA®æ¦¡¨Ï¥Î§ë¼v ¡£map¡¤ÀÉ¡C¤U­z¬°§ë¼vÀɪº¤@¨Ò¡G

<a href="/map/mapfile.map">
<img src="picture.gif" ISMAP>
</a>

¨Ò¤¤¡Amapfile.map§Y¬°§ë¼vÀÉ¡C¦Ópicture.gif¬°ÂI¿ï¥Îªº¹Ï§Î¡C

¦³«Ü¦hµ{¦¡¥i¥Î¨Ó²£¥Í¯à»PNCSA§ë¼vÀɦ@¦sªºÀɮסA§A¤]¥i¥H¦Û¤v½s¼g¤@¤ä¡C¬ÛÃö²Ó ¸`½Ð°Ñ¦Ò¡GApacheweek http://www.apacheweek.com/features/imagemaps¡C

7.12 SSI/XSSI

¦øªA¾¹ºÝ¥[¤J¡£SSI¡¤¥i¦bÀRºAªººô­¶¤¤¥H°ÊºA¤è¦¡¥[¤J¬Y¨Ç¤º®e¡C­n¥[¤Jªº¶µ¥Ø¦b ºô­¶¤¤¥H»¡©ú¡£comment¡¤ªº¤è¦¡ªí¥Ü¡C¦øªA¾¹¥ý¸ÑªR³o¨Ç¶µ¥Ø¡AµM«á±N©Ò­nªº¤º®e ¥[¤J¡CSSI¥i¦bÀɮפ¤¥[¤Jheader¤Îfooter¡A¤]¥i¥H¥[¤J³Ì«á­×§ï¤é´Á¡A¤]¥i°õ¦æ¨t ²Î©R¥O©ÎCGI script¡C¦pªG¨Ï¥Î©µ¦ù«¬¦øªAºÝ¥[¤J ¡£XSSI; eXtended Server Side Includes¡¤¡A¥i°µªº´N§ó¦h¤F¡C¥¦¥i ¥[¤JÅܼƤάyµ{±±¨î¡£¦pif¡Belseµ¥¡¤¡C³o²ª½´N¹³¤@­Ó¦b¨Ï¥Î¤@­Óµ{¦¡»y¨¥¡C

¦p­n¹ï¨C¤@­ÓHTMLÀɳ£¥[¥H¸ÑªR¡A·|®ø¶O¤Ó¦h¨t²Î¸ê·½¡C©Ò¥H­n¦³­Ó¤èªk¨Ï¨º¨Ç¦³SSI ¶µ¥ØªºÀɮ׬ݨӤ£¤@¼Ë¡C¤@¯ëªº§@ªk¬O¡A§â³o¨ÇHTMLªº©µ¦ùÀɦW§ï¬°.stml¡C

­n±Ò¥ÎSSI/XSSI¡A­º¥ý½T»{¬O§_¸Ó¥\¯àªº¼Ò¦¡¤w¸g¦w¸Ë¡CµM«á´N¥i­×§ïsrm.conf ÀÉ¡A¬°.shml«¬¦¡ªºAddType¤ÎAddHandler¶}±Ò¡£uncomment¡¤¡C³Ì«á ¥ÎOptions Includes¨Ó©w¸q¨º¨Ç¥Ø¿ý¤USSI/XSSIÀÉ¥i¹B¦æ¡C³o¤@¨BÆJ¬O¦b access.confÀɤ¤¡C¨º»ò©Ò¦³¨ã.shtml©µ¦ùÀɦWªºÀɮ׳£·|³Q¸ÑªR°õ¦æ SSI/XSSI¡C

¥t¤@ºØ¦bºô­¶¤¤¥[¤J¤º®eªº¤è¦¡¬O¨Ï¥ÎXBitHack«ü¥O¡C³o­Ó«ü¥O¤@¶}±Ò¡A¥¦·| Àˬd¸ÓÀɮ׬O§_¬°user exectable¡C¦pªG¬O¡A¦Ó¥B¸Ó¥Ø¿ý¥ÎOptions Includes¶} ±Òªº¸Ü¡A¸ÓÀÉ®×´N³Qµø¬°SSIÀɮסC¦ý³oºØ¤è¦¡¥u¹ïmime «¬¦¡ªºtext/html ¡£.html .htmÀɮס¤¦³®Ä¡C©Ò¥H¤£¬O³Ì¦nªº¤èªk¡C

¥ÎSSI¨Ó°õ¦æ¨t²Î©R¥O¤ÎCGI script¡A·|¾É­P¤@¨Ç«O¥þªº­·ÀI¡C©Ò¥H¦b access.confÀɤ¤³Ì¦n¨Ï¥ÎOption IncludesNOEXEC¦Ó¤£­n¥ÎOption Includes¡C ¨ä¥LSSI©R¥O«h¤£¶·­×§ï¡C

¬ÛÃö²Ó¸`°Ñ¦Ò­ì©lµ{¦¡ªþ±aªºApache mod-includes¤å¥ó¡C ¥i¥H±q http://www.apache.org/docs/mod/mod_include.html¨ú±o¡C

SSI/XSSI¹ê²{ªº¬ÛÃö²Ó¸`°Ñ¦ÒApacheweek http://www.apacheweek.com/features/ssi.

¦³ÃöSSI©R¥Oªº¸ê°T¡A°Ñ¦ÒNCSA¤å¥ó http://hoohoo.ncsa.uiuc.edu/docs/tutorials/includes.html¡C

¦Ó¦³ÃöXSSI©R¥Oªº¸ê°T¡A°Ñ¦Ò ftp://pageplus.com/pub/hsf/xssi/xssi-1.1.html¡C

7.13 ¼Ò²Õ¨t²Î

Apache¥i¥Î¼Ò²Õªº¤è¦¡¥[¤J¥ô¦óªF¦è¡C²{¦b¤w¦³ªº¼Ò²Õ«Ü¦h¡A¦ý¥u¦³¤@¯ë±`¥Îªº¼Ò²Õ ªþ±a¦bApache®M¥ó¤¤¡C

­n¬d¬d¬ÝÁÙ¦³¨º¨Ç¼Ò²Õ¡A½Ð°Ñ¦ÒApache¼Ò²ÕÄ_®w http://www.zyzzyva.com/module_registry/¡C

¦Ó¦³Ãö¼Ò²Õ¤Æ³]­pªº¸ê°T¡A°Ñ¦Ò http://www.zyzzyva.com/module_registry/reference/¡C


Next Previous Contents