Next Previous Contents

2. ¦w¸Ë HTTP ¦øªA¾¹

·í§A¤U¸ü¦øªA¾¹³nÅé®É¡A§A¦³¨â­Ó¿ï¾Ü: ¨ú¥Î­ì©lµ{¦¡ÀɦA¦Û¤v¨Ó½sĶ¥¦¡A ©Î¬O¨ú¥Î¤w¸g½sĶ¦nªº¤G¶i¦ì°õ¦æÀÉ¡C ¤w½sĶ¦nªºµ¹ Linux (ELF ª©¥» ) ¥Îªº¤G¶i¦ìÀÉ¥i¥H¦b NCSA ¤W¨ú±o¡A¥¦­Ì³£«Dªºª©¥»®@!

2.1 ¤U¸ü«eªº·Ç³Æ¤u§@

¦b NCSA ªº¦øªA¾¹·|¾É¤Þ§A°µ«Øºc¿ï¶µªº¨BÆJ¨Ã¬°§A®Æ²z³\¦hÀɮסC¦ý¦b±z À|¸Õ­n¤U¸ü HTTPd «e½Ð¥ý¦^µª¤U¦C°ÝÃD

§@·~¨t²Î

­º¥ý¡A§A¥²¶·¿ï¾Ü¬O­n¤U¸ü­ì©lµ{¦¡ÀɮשO? ÁÙ¬O¤w½sĶ¦nªº³nÅé¡C¦pªG§A ªº¨t²Î¨Ã¨S¥X²{¦b¿ï³æ¤W¡A¨º»ò±z´N¥²¶·¨ú¦^¤º©wªº­ì©lÀɮסA¦A¦Û¤v½sĶ ¥¦¡C

­nÀˬd§Aªº Linux ªºª©¥»¡A½Ð¦^¨ì§Aªº Linux ©R¥O¦C¤W¥´¤J

  linux:~$  uname -a
¥¦·|¦^À³¹³¤U­±ªº¤º®e
   linux:~$  uname -a
   Linux linux 2.0.29 #4 Tue Sep 13 04:05:51 CDT 1994 i586
   linux:~$

¬O Linux is 2.0.29 ª©¥»¡C

¨ä¥Lªº°Ñ¼Æ¥i¥H¦b¤U¸ü«e¨Ó«ü©w¡A©Î¬O¥H­×§ï¦b /usr/local/etc/httpd/conf ¥Ø¿ý¤ºªº srm.conf Àɮרӫغc¡C ¦bhttpd.confÀɮפº©Ò ¸ü©úªº¹ê»Ú¥Ø¿ý·|Åã¥Ü¦bùØÀY¡C°ß¤@ªº¨Ò¥~¬Osrm.confÀɮפºªºª½±µªºDocumentRoot¡C

³B²zÃþ«¬ (¦øªA¾¹Ãþ«¬)

³o¶µ¬O¨Ó«ü©w§Aªº¾÷¾¹·|«ç»ò¦a°õ¦æ§Aªº HTTPd ¦øªA¾¹¡C ³Ì¦nªº¤èªk¬O "standalone"¡C³o¼Ë¥iÅý HTTP ºëÆF¤@ª½¦a°õ¦æ¡C¦pªG±z¿ï¾Ü¸ü ¤J HTTPd ¦b "inetd" ¤º¡A¦øªA¾¹ªº¤G¶i¦ì½X·|¦b¨C¤@¦¸ªº»Ý¨D ®É³Q­«¸ü¤J°O¾ÐÅ餺¡A³o¼Ë¥i¯à·|´îºC§Aªº¦øªA¾¹¡C

³s±µ°ð (°ð)

³o¶µ«ü©w±zªº¾÷¾¹ªº­þ¤@­Ó°ð·|³Q HTTPd ºëÆF¨Ï¥Î¨Ó bind to ¤Î²âÅ¥ HTTP ½Ð¨D¡C¦pªG§A¥i¥Hñ§@¦¨ "root"¡A½Ð¨Ï¥Î¤º©w­È 80¡C ©Î ªÌ½Ð¦b 1025 ¨ì 65535 ¤§¶¡¬D¿ï¤@­Ó¡C

¦øªA¾¹¨Ï¥ÎªÌÃѧO (¨Ï¥ÎªÌ)

³o¬O¦øªA¾¹¦bµªÂЭn¨D®É§ïÅܦ¨¬°ªº¤Î¹ê»Ú§@¥ÎªºÀɮ׮ɩһݪº¨Ï¥ÎªÌÃѧO¡C ¥u¦³§A±N¦øªA¾¹·í "¿W¥ß³æ¾÷"®É¤~»Ý­n¦^µª³o­Ó°ÝÃD¡C¦pªG§A ¨S¦³ root ªº±ÂÅv¡A¥u»Ý¨Ï¥Î§Aªº¾E¤J¦WºÙ§Y¥i¡C¦pªG§A¬O¨t²ÎºÞ²z­û¡A §A¥i¯à·|·Q«Ø¥ß¤@­Ó¯S§Oªº¨Ï¥ÎªÌ¨ÓÅý§A±±¨îÀɮרt²Îªº±ÂÅv¡C

¦øªA¾¹¸s²ÕÃѧO (¸s²Õ)

³o¬O¸s²ÕÃѧO¦WºÙ¡A¦øªA¾¹·|¦b¦^À³»Ý¨D¤Î¦b³o¨ÇÀÉ®×°Ê¥ó®É§ïÅܦ¨¥¦­Ì¡C ¥¦©M¦øªA¾¹¨Ï¥ÎªÌÃѧO¦WºÙ¦³ÂI¬Û¦P¡A¦Ó¥B¥u¦³¦b§A¿W¦Û°õ¦æ¦øªA¾¹®É¤~¥i ¥H¨Ï¥Î¡C

¦pªG§A¨S¦³ root ªºÅv­­¡A ½Ð¨Ï¥Î§Aªº¥D­n¸s²Õªº¦W¸q¡C §A¥i¥H¦b Linux ªº©R¥O¦C¤¤¥´¤J groups ±oª¾±zªº¸s²Õ¦WºÙ¡C

¦øªA¾¹ºÞ²z­û¹q¤l¶l¥ó¦a§} (¦øªA¾¹ Admin)

³o¬O·í¨Ï¥ÎªÌ­n³ø§i¦b¦øªA¾¹¤W¦³­þ¨Ç°ÝÃD®É­n±H¹q¤l¶l¥ó°µ³ø§iªº¦a§}¡C §A¥i¥H¶ñ¤W§Aªº­Ó¤Hªº e-mail¦a§}¡C

¦øªA¾¹¥Ø¿ýªº¦ì¸m (¦øªA¾¹Root)

³o¬O«ü¦øªA¾¹¦ì©ó§Aªº¨t²Îªº­þ­Ó¦a¤è¡C¦pªG§A¦³ root ªºÅv­­¡A½ÐÅý¥¦´N ¨Ì·Ó¥¦©Ò«Øijªº¦aÂI /usr/local/etc/httpd ¤º¡C ¦pªG§AµLªk¥H root ªº¨­¥÷ñ¤J¡A½Ð¦b§Aªº home ¥Ø¿ý¤º¿ï¾Ü¤@­Ó¦¸¥Ø¿ý¡C§A¥i¥H¨Ï¥Îind out the path of your home directory with the pwd command.

HTML Àɮתº¦ì¸m (DocumentRoot)

³o¨à¬O³Q¦øªA¨Ï¥Îªº HTML Àɮ׳Q©ñ¸mªº¦aÂI¡C ¤º©wªº¦ì¸m¬O /usr/local/etc/httpd/htdocs¡CµM¦Ó§A¥i¥H§â¥¦³]©w¦¨§A¦b¦øªA ¾¹¨Ï¥ÎªÌÃѧO¦WºÙ¤ºªº¯S§Oªº¨Ï¥ÎªÌªº home ¥Ø¿ý¡A©Î¬O§Aªº home ¥Ø¿ý¤º ªº¤@­Ó¤l¥Ø¿ý (°²¦p§AµLªk¾E¤J¦¨¬° root ªº¸Ü¡^¡C

¦pªG¤£¾å±o¡A½Ð¨Ï¥Î¤º©w­È¡C²{¦b§A¤w¸g¦³¤W­±°ÝÃDªºµª®×¤F¡A§A´N¥i¥H ±q http: //hoohoo.ncsa.uiuc.edu/docs/setup/OneStep.html ¤U¸ü NCSA HTTPd¡C ¦b¦w¸Ë«e§AÀ³¸Ó¾\Ū©ñ¦b http: //hoohoo.ncsa.uiuc.edu/docs/ ¤ºªº HTTPd ¤å¥ó¡C¦pªG§A­pµe½sĶ°õ¦æ½X¡A¨º§A»Ý­n­×§ï¦bsupport, src, cgi-src ¤T­Ó¥Ø¿ý¤ºªº¨C¤@­Ó makefiles ÀÉ¡C¦pªG§Aªº Linux ª©¥»¤w¸g¤ä´©¤F¡A¨º»ò§A¥u»Ý ¦b³Ì¤WºÝªº¥Ø¿ý¤W°õ¦æmake linux¡C(¦p /usr/local/etc/httpd)

2.2 ½sĶ HTTPd

³o«Ü²³æ¡A ¥u­n¦b¦øªA¾¹ªº root ¥Ø¿ý¤ºªº©R¥O¦C¤WÁä¤J make linux §Y¥i¡C µù: ¦b½sĶ«e¡Apre-ELF Linux ªº¨Ï¥ÎªÌ (¨S¦³ ELF ¥\¯àªº Linux) ¶·±N portability.h Àɮפºªº #define NO_PASS ¦Cªºµù¸Ñ²Å¸¹®³±¼¨Ã¥B³]©w Makefile ¤ºªº DBM_LIBS= -ldbm¡C


Next Previous Contents