SERVER SIDE INCLUDE

SSI(Server Side Include)¶õ ±× ´Ü¾î ÀÚü¿¡¼­ ÀÇ¹Ì ÇϵíÀÌ Client(ºê¶ó¿ìÀú)º¸´Ù´Â Server¿¡ °ü·ÃµÈ ¹®¹ýÀÌ´Ù. ¶ÇÇÑ ¿©·¯ HTML tagµé°úµµ ¸¹Àº Â÷ÀÌ°¡ ÀÖ´Ù.
ÀϹÝÀûÀ¸·Î ¼­¹öÀÇ ¿ªÇÒÀº ºê¶ó¿ìÀú¿¡¼­ ¿ä±¸ÇÑ ÆÄÀÏÀ» Àü¼ÛÇÏ¿© Áֱ⸸ ÇÏ´Â °ÍÀÌ´Ù. µû¶ó¼­ ´ëºÎºÐÀÇ tagµéÀ» ¹ø¿ªÇÏ°í ó¸®ÇÏ´Â °ÍÀº ClientÀÇ ¸òÀÌ´Ù. ±×·¯³ª, SSIÀÇ °æ¿ì´Â Server(HTTPd)¿¡¼­ tagÀ» ó¸®ÇÏ°Ô µÈ´Ù. ¾Æ·¡ÀÇ ¿¹¸¦ º¸¸é ±× °úÁ¤À» ÀÌÇØÇÒ ¼ö ÀÖ´Ù.
½ÇÁ¦ ÆÄÀÏ ¼Ò½º ÄÚµåºê¶ó¿ìÀú¿¡¼­ ¹ÞÀº ÄÚµå
<h2>SSIÀÇ ¿¹</H2>
<!--include file="included.html"-->
<p>End of Contents
<h2>SSIÀÇ ¿¹</H2>
<B>´Ù¸¥ ÆÄÀÏ</B>
"include.html" was included!
<p>End of Contents
include.htmlÀÇ ³»¿ë
<B>´Ù¸¥ ÆÄÀÏ</B>
"include.html" was included!
ºê¶ó¿ìÀú¿¡¼­´Â <!--comments-->¸¦ ´ÜÁö ÁÖ¼®¹®À¸·Î ó¸®ÇÏ°í Ãâ·ÂÇÏÁö ¾Ê´Â´Ù. ±×·±µ¥ À§ÀÇ ¿¹¿Í °°ÀÌ Æ¯Á¤ÇÑ ÇüÅ·Π»ç¿ëµÈ °æ¿ì¿¡´Â ¼­¹ö¿¡¼­ ÆÄÀÏÀÇ ³»¿ëÀ» ±×´ë·Î ºê¶ó¿ìÀú·Î º¸³»Áö ¾Ê°í, ¼­¹öÀÇ ¹®¹ý¿¡ µû¶ó ±× ³»¿ëÀ» ÀÏ´Ü °¡°øÇÑ ´ÙÀ½ º¸³»°Ô µÈ´Ù. À§ÀÇ °æ¿ì´Â ÁöÁ¤µÈ ´Ù¸¥ ÆÄÀÏÀ» »ðÀÔÇÏ¿© ºê¶ó¿ìÀú¿¡ º¸³»°Ô µÈ´Ù.

¸ðµç ¼­¹öµéÀÌ SSI¸¦ Áö¿øÇÏ´Â °ÍÀº ¾Æ´Ï´Ù. ¶ÇÇÑ ¼­¹öÀÇ Á¾·ù¿Í ¹öÀü¿¡ µû¶ó ±× ¹®¹ýÀÌ ´Ù¸¦ ¼ö ÀÖ´Ù. µû¶ó¼­ ÀÚ½ÅÀÌ »ç¿ëÇÏ´Â HTTPdÀÇ SSI ¹®¹ý¿¡ ÀûÇÕÇÏ°Ô ¸¸µé¾î¾ß ÇÑ´Ù. ±×·¯³ª ¼­¹ö¸¶´Ù ±× ¹®¹ýÀÌ Å©°Ô ´Ù¸£Áö´Â ¾Ê´Ù. ¿©±â¼­´Â NCSA HTTPD (¹öÀü 1.4ÀÌ»ó)À» ±âÁØÀ¸·Î ¼³¸íÇÑ´Ù.
SSI¸¦ »ç¿ëÇϱâ À§Çؼ­´Â HTTPdÀÇ conf ÆÄÀÏÀ» ¼öÁ¤ÇÏ¿©¾ß ÇÑ´Ù. access.confÀÇ Options directive¿¡¼­ Includes ¶Ç´Â IncludesNOEXEC¸¦ ÁöÁ¤ÇÏ¿©¾ß ÇÑ´Ù. ±×¸®°í srm.conf¿¡ AddType directive¸¦ »ç¿ëÇÏ¿© ´ÙÀ½°ú °°ÀÌ MIME typeÀ» µî·ÏÇÏ¿©¾ß ÇÑ´Ù.
AddType text/x-server-parsed-html .shtml
ÀÌ·¸°Ô Çϸé SSI¸¦ »ç¿ëÇÏ°íÀÚ ÇÏ´Â ÆÄÀÏÀÇ È®ÀåÀÚ¸¦ .shtml·Î Á¦ÇÑÇÏ°Ô µÈ´Ù. ¸¸¾à ¸ðµç HTML ¹®¼­¿¡¼­ SSI¸¦ »ç¿ëÇÏ°íÀÚ ÇÑ´Ù¸é ´ÙÀ½°ú °°ÀÌ ÇÏ¿©¾ß ÇÑ´Ù.
AddType text/x-server-parsed-html .html

SSI¿¡¼­ »ç¿ëµÇ´Â ÇüÅ´ ´ÙÀ½°ú °°À¸¸ç, À̶§ ´ë¼Ò¹®ÀÚ¸¦ ±¸º°ÇÏ¿©¾ß ÇÑ´Ù.

<!--#command tag1="value1" ......-->

<!--#config [errmsg="string"] [timefmt="time_format"] [sizefmt="bytes"|"abbrev"]-->

SSI Ãâ·ÂÇü½Ä¿¡ °üÇÑ Çü½ÄÀ» ÁöÁ¤/º¯°æÇÑ´Ù.
errmsgSSI 󸮰úÁ¤¿¡¼­ ¿¡·¯°¡ ¹ß»ýÇÑ °æ¿ì(¿¹¸¦ µé¸é, includeÇÒ ÆÄÀÏÀÌ Á¸ÀçÇÏÁö ¾Ê´Â´Ù°Å³ª)¿¡ Ãâ·ÂµÉ ¿¡·¯ ¸Þ½ÃÁöÀÇ ³»¿ëÀ» ÁöÁ¤ÇÑ´Ù.
timefmt<!--#flastmod ... --> µî°ú °°Àº ½Ã°£ Ãâ·Â¿¡ »õ Çü½ÄÀ» ÁöÁ¤ÇÑ´Ù. À̶§ ±× Çü½ÄÀº C library ÇÔ¼öÀÎ strftimeÀÇ specifiers¿Í °°´Ù.
sizefmt<!--#fsize ... -->¿¡¼­ ÆÄÀÏ Å©±â Ãâ·ÂÇü½ÄÀ» Á¤ÇÑ´Ù. "bytes"´Â byte ´ÜÀ§, "abbrev"´Â Kbyte´ÜÀ§·Î Ãâ·ÂÇÑ´Ù. ±âº»°ª(default)Àº "abbrev"ÀÌ´Ù.
<!--#include [virtual="virtural_path"] [file="relative_path"]-->

ÁöÁ¤µÈ ÆÄÀÏÀ» »ðÀÔÇÑ´Ù.
virtual virtual path; anchor¿¡¼­ ÁöÁ¤ÇÏ´Â path¿Í °°´Ù. "/index.html" , "/~someone/intro.html"°ú °°Àº Àý´ë path·Î ÁöÁ¤ÇÑ´Ù.
file ÇöÀç ¹®¼­¿¡ ´ëÇÑ »ó´ë path·Î ÁöÁ¤µÈ´Ù. ´Ü, »óÀ§µð·ºÅ丮(../filename.html)´Â ÁöÁ¤ÇÒ ¼ö ¾ø´Ù.
<!--#echo var="enviroment_variable"-->

ȯ°æº¯¼ö(enviroment variable)ÀÇ °ªÀ» Ãâ·ÂÇÑ´Ù. CGIȯ°æ º¯¼ö ¹× ´ÙÀ½ º¯¼öµéÀ» »ç¿ëÇÒ ¼ö ÀÖ´Ù.
DOCUMENT_NAMEÇöÀç ÆÄÀÏÀÇ À̸§
DOCUMENT_URIÇöÀç ÆÄÀÏÀÇ virtual path
QUERY_STRING_UNESCAPEDThe unescaped version of any search query the client sent, with all shell-special characters escaped with \.
DATE_LOCALÇöÁö ½Ã°¢ (configÀÇ timefmt°¡ ÁöÁ¤µÇ¸é ±× Çü½ÄÀ¸·Î Ãâ·Â)
DATE_GMTGMT Ç¥ÁØ ½Ã°¢ (cofngÀÇ timefmt°¡ ÁöÁ¤µÇ¸é ±× Çü½ÄÀ¸·Î Ãâ·Â)
LAST_MODIFIEDÇöÀç ÆÄÀÏÀÇ ³»¿ëÀÌ ÃÖ±Ù º¯°æµÈ ½Ã°£ (cofngÀÇ timefmt°¡ ÁöÁ¤µÇ¸é ±× Çü½ÄÀ¸·Î Ãâ·Â)
<!--#fsize [virtual="virtural_path"] [file="relative_path"]-->

ÆÄÀÏÀÇ Å©±â¸¦ Ãâ·Â. virtual°ú fileÀº include¿¡¼­¿Í µ¿ÀÏÇÏ°Ô »ç¿ëµÈ´Ù. configÀÇ sizefmt¿¡ µû¸¥´Ù.
<!--#flastmod [virtual="virtural_path"] [file="relative_path"]-->

ÆÄÀÏÀÇ ÃÖ±Ù º¯°æ ½Ã°¢ Ãâ·Â. virtual°ú fileÀº include¿¡¼­¿Í µ¿ÀÏÇÏ°Ô »ç¿ëµÈ´Ù. configÀÇ timefmt¿¡ µû¸¥´Ù.
<!--#exec [cmd=shell_command] [cgi=cgi_script]-->

Ä¿¸Çµå³ª CGI script¸¦ ½ÇÇàÇÏ¿© ±× °á°ú¸¦ Ãâ·ÂÇÑ´Ù. À̶§ Ä¿¸Çµå¿¡ Àμö(argument)¸¦ Àü´ÞÇÒ ¼ö´Â ÀÖÀ¸³ª, CGI¿¡ Äõ¸®(query)¸¦ Àü´ÞÇÒ ¼ö´Â ¾ø´Ù.
<!--#exec cmd="finger gang@phya.yonsei.ac.kr"-->¡Û
<!--#exec cgi="/cgi-bin/finger?gang@phya.yonsei.ac.kr"-->¡¿

[»ç¿ë¿¹]
[¼­¹öÀÇ ¼Ò½ºÄÚµå]
<title>SSI Ex</title>
<h1 align=center>Server Side Include</h1>

<p>configurating time format
<!--#config timefmt="The time is %A. %I:%M %p %Z"-->

<P>file size<br>
<!--#fsize file="ssi.html"-->
<!--#config sizefmt="bytes"-->
<!--#fsize file="ssi.html"-->

<p>last modified time<br>
<!--#flastmod file="ssi.html"-->
<br>/index.html <!--#flastmod virtual="/index.html"-->
<br>/~gang/index.html <!--#flastmod virtual="/~gang/index.html"-->

<p>execution<br>
<!--#exec cmd="who am i"-->

<p>echo document name<br>
<!--#echo var="DOCUMENT_NAME"-->    
[ºê¶ó¿ìÀú¿¡¼­ ¹ÞÀº ¼Ò½ºÄÚµå]
<title>SSI Ex</title>
<h1 align=center>Server Side Include</h1>

<p>configurating time format


<P>file size<br>
   1K

540

<p>last modified time<br>
The time is Thursday. 09:52 AM KST
<br>/index.html The time is Tuesday. 05:08 PM KST
<br>/~gang/index.html The time is Friday. 10:32 PM KST

<p>execution<br>
nobody   tty??   Mar  7 09:52


<p>echo document name<br>
ssiex.html

Âü°íÇÑ ÆäÀÌÁöµé

NCSA HTTPd Tutorial:Server Side Includes (SSI)
http://hoohoo.ncsa.uiuc.edu/docs/tutorials/includes.html
Server-Side-Includes Tutorial
http://web.sau.edu/~mkruse/www/info/ssi.html