ssi.xml.ko revision e095ed6283178339b437a6f15ebcc8a08289fb0d
<?xml version='1.0' encoding='EUC-KR' ?>
<!DOCTYPE manualpage SYSTEM "/style/manualpage.dtd">
<?xml-stylesheet type="text/xsl" href="/style/manual.ko.xsl"?>
<!-- English Revision: 151408 -->
<!--
Copyright 2004-2005 The Apache Software Foundation or its licensors,
as applicable.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<manualpage metafile="ssi.xml.meta">
<parentdocument href="./">How-To / Tutorials</parentdocument>
<title>����ġ ���丮��: Server Side Includes �Ұ�</title>
<summary>
<p>Server-side includes�� ����Ͽ� HTML ������ ������ ������
�߰��� �� �ִ�.</p>
</summary>
<section id="related"><title>�Ұ�</title>
<related>
<modulelist>
<module>mod_include</module>
<module>mod_cgi</module>
<module>mod_expires</module>
</modulelist>
<directivelist>
<directive module="core">Options</directive>
<directive module="mod_include">XBitHack</directive>
<directive module="mod_mime">AddType</directive>
<directive module="core">SetOutputFilter</directive>
<directive module="mod_setenvif">BrowserMatchNoCase</directive>
</directivelist>
</related>
<p>�� ���� ���� SSI��� �θ��� Server Side Includes�� �����Ѵ�.
SSI�� �����ϵ��� ������ �����ϴ� ���� HTML �������� ������
������ �߰��ϴ� �⺻���� SSI ������ �Ұ��Ѵ�.</p>
<p>�� ���� �޺κ��� SSI ���þ� ���ǹ��� ���� ��ޱ����
�����Ѵ�.</p>
</section>
<section id="what"><title>SSI�� ������</title>
<p>SSI (Server Side Includes)�� HTML �������� ����ϴ� ���þ��,
�������� �����Ҷ� ������ ó���Ѵ�. SSI�� ����ϸ� CGI
���α׷��̳� �ٸ� ������ ���� ������ ��ü�� ����
�������� �ʰ? HTML �������� �������� ���� ������ �߰���
�� �ִ�.</p>
<p>SSI�� ������� �ƴϸ� ���α׷����� ������ ��ü�� ������
������ ���������� ������ ��� �������� �������� ������
������ ��������� �ٽ� ����ؾ������� �޷ȴ�. SSI�� ����
�ð��� ���� ���� ������ �߰��ϴµ� ����. �׷��� ��������
�����Ҷ� �������� ��κ��� ���ؾ� �Ѵٸ� �ٸ� �����
ã�ƺ��� �Ѵ�.</p>
</section>
<section id="configuring">
<title>SSI�� �����ϵ��� ���� �����ϱ�</title>
<p>������ SSI�� ó���Ϸ��� <code>httpd.conf</code> �����̳�
<code>.htaccess</code> ���Ͽ��� ���� ���þ ����ؾ� �Ѵ�.</p>
<example>
Options +Includes
</example>
<p>�׷��� ����ġ�� ���Ͽ��� SSI ���þ ó���Ѵ�. ��������
���� ���� <directive module="core">Options</directive> ���þ
�ְ�, �� ���þ���� ���� ����Ἥ ��ȿ�� �����. �׷���
���þ �Ǹ������� ó���ϱ����� ���� SSI�� ���ϴ� Ư��
���丮���� <code>Options</code>�� ����Ѵ�.</p>
<p>��� ���Ͽ��� SSI ���þ ó���ϴ� ���� �ƴϴ�. ����ġ����
� ������ ó������ �˷���� �Ѵ�. �ΰ��� ����� �ִ�.
�ϳ��� ������ ���� ���þ�� <code>.shtml</code>�� ���� Ư��
���� Ȯ���ڸ� ���� ������ ó���ϴ� ����̴�.</p>
<example>
AddType text/html .shtml<br />
AddOutputFilter INCLUDES .shtml
</example>
<p>�� ����� ������ �̹� �ִ� �������� SSI ���þ �߰��ϴ�
��� SSI ���þ ó���ϱ����� <code>.shtml</code> Ȯ���ڸ�
�ο��ϱ⶧���� ���ϸ�� �� �������� ��� ��ũ�� �����ؾ�
�ϴ� ���̴�.</p>
<p>�ٸ� ����� <directive module="mod_include">XBitHack</directive>
���þ ����ϴ� ����̴�.</p>
<example>
XBitHack on
</example>
<p><directive module="mod_include">XBitHack</directive>��
��������� �ִ� ���Ͽ��� SSI ���þ ó���Ѵ�. �׷��� �̹�
�ִ� �������� SSI ���þ �߰��Ѵٸ� ���ϸ��� ��������
�ʰ� <code>chmod</code>�� ���Ͽ� ��������� �ָ� �ȴ�.</p>
<example>
chmod +x pagename.html
</example>
<p>���� ���ƾ� �� �� �ϳ�. ���� <code>.shtml</code> ���ϸ?
��ġ�� �������� ��� <code>.html</code> ������ SSI ó���϶��
����ϴ� ����� �ִ�. �� ������� �Ƹ��� <directive
module="mod_include">XBitHack</directive>�� ���� �𸣴�
�� ����. ����� ���� �̷��� �ϸ� ����ġ�� ���Ͽ� SSI ���þ
����� Ŭ���̾�Ʈ�� ������ ��� ������ ������� �Ѵٴ�
���̴�. ������ �ſ� ������ �� ������, ���� ���� �ƴϴ�.</p>
<p>���� ����������� ��������̶� ���� ��⶧���� ���ڸ�
����� �� ���.</p>
<p>������ �����̿��� ����ϱ� ��Ʊ⶧���� ����ġ �⺻ ������
SSI �������� �ֱټ����ϰ� content length HTTP ����� ������
�ʴ´�. �׷��� ������ ij������ ���ϰ� Ŭ���̾�Ʈ�� ������
������ �������. �ΰ��� �ذ����� �ִ�.</p>
<ol>
<li><code>XBitHack Full</code> ������ ����Ѵ�. �׷���
����ġ�� �����ϴ�(include) ���ϵ��� �������� ������ü
�� ��û�� ������ ��¥�� ���� �ֱټ������� �˾Ƴ���.</li>
<li><module>mod_expires</module>�� �ִ� ���þ ����Ͽ�
���Ͽ� ���� �������� �����ϸ� ������� ���Ͻð� ������
ij���� �� �ִ�.</li>
</ol>
</section>
<section id="basic"><title>�⺻ SSI ���þ�</title>
<p>SSI ���þ��� ������ ������ ����.</p>
<example>
&lt;!--#element attribute=value attribute=value ... --&gt;
</example>
<p>HTML �ּ����� ���⶧���� SSI ����� �������� �ʾƵ�
HTML �ҽ����� �������� ������� �����Ѵ�. SSI�� �ùٷ�
�����ϸ� ���þ ������� �ٲ۴�.</p>
<p>element�� ������ �ϳ���. ���� ȸ�� �� �ڼ��� ������ ���̴�.
������ SSI�� �� �� �ִ� ��� ���� ���δ�</p>
<section id="todaysdate"><title>���� ��¥</title>
<example>
&lt;!--#echo var="DATE_LOCAL" --&gt;
</example>
<p><code>echo</code> element�� �������� �״�� ����Ѵ�.
CGI ���α׷��� �����ϴ� ȯ�溯���� �ܿ��� ���� ǥ�� ������
�ִ�. ��, <code>set</code> element�� ����Ͽ� ���� ������
������ ���� �ִ�.</p>
<p>��¥ ��� ����� ������ ���� �ʴ´ٸ�, ������ ����
<code>config</code> element�� <code>timefmt</code> attribute��
����Ѵ�.</p>
<example>
&lt;!--#config timefmt="%A %B %d, %Y" --&gt;<br />
Today is &lt;!--#echo var="DATE_LOCAL" --&gt;
</example>
</section>
<section id="lastmodified"><title>������ ������</title>
<example>
�� ������ &lt;!--#flastmod file="index.html" --&gt;�� ���������� �����Ǿ��
</example>
<p>�� element�� <code>timefmt</code> ��� ������ �޷ȴ�.</p>
</section>
<section id="cgi"><title>CGI ���α׷� ��� �����ϱ�</title>
<p>�Ϲ����� SSI ������ �ϳ���, ���̵� �ֿ��ϴ� ``�湮��
ī����'' ���� CGI ���α׷� ��� ����Ѵ�.</p>
<example>
&lt;!--#include virtual="/cgi-bin/counter.pl" --&gt;
</example>
</section>
</section>
<section id="additionalexamples">
<title>�߰� ����</title>
<p>������ HTML ������ ����� �� �ִ� ��� SSI ������.</p>
<section id="docmodified"><title>�� ������ ���� ����������
�����Ǿ�?</title>
<p>�տ��� SSI�� ����Ͽ� ����ڿ��� ������ �ֱټ�������
�˸� �� �ִٰ� ���ߴ�. �׷��� ���� ����� �˷����� �ʾҴ�.
���� �ڵ带 HTML ������ ����ϸ� �������� �ð� ����� �����.
���� ������ �����Ѵ�� SSI�� �ùٷ� �۵��ؾ� �Ѵ�.</p>
<example>
&lt;!--#config timefmt="%A %B %d, %Y" --&gt;<br />
�� ������ &lt;!--#flastmod file="ssi.shtml" --&gt;�� ���������� �����Ǿ��;
</example>
<p>���� <code>ssi.shtml</code>��� ���ϴ� ���� ���ϸ���
����Ѵ�. �ƹ� ���������� �ٿ����� �� �ִ� ����ڵ带
���Ѵٸ�, ���ϸ� ��� <code>LAST_MODIFIED</code> ������
����Ѵ�.</p>
<example>
&lt;!--#config timefmt="%D" --&gt;<br />
This file last modified &lt;!--#echo var="LAST_MODIFIED" --&gt;
</example>
<p><code>timefmt</code> ��Ŀ� ���� �ڼ��� ������ �˻�����
<code>strftime</code>�� ã�ƺ���. ������ ����.</p>
</section>
<section id="standard-footer">
<title>ǥ�� ������ �ϴ��� �����ϱ�</title>
<p>���� �������� �ִ� ����Ʈ�� ���Ѵٸ� ������ ��ü��
�����ϴ� ����, Ư�� ���������� ǥ�� �ܰ��� �������� �����ϴ�
���� ������ ���Ӵ�.</p>
<p>������ ���(header)�� �ϴ�(footer)�� ���Ϸ� �����Ͽ�
�̷� ������ �δ��� �� �� �ִ�. ��� ����������
<code>include</code> SSI ��ɾ ����Ͽ� ������ �ϴ� ����
�ϳ��� �����ϸ� �ȴ�. <code>include</code> element��
<code>file</code> attribute�� <code>virtual</code> attribute��
������ ������ �����Ѵ�. <code>file</code> attribute�� <em>����
���丮�� �������</em> ���ϰ�δ�. ��, (/�� �����ϴ�)
������ϰ�γ� ��� �ȿ� ../�� ����� �� ���. �Ƹ��� �����ϴ�
������ ��� URL�� ������ �� �ִ� <code>virtual</code> attribute��
�� ������ ���̴�. ��θ� /�� ������ �� ������, �����Ϸ���
������ �����ϴ� ���ϰ� ���� ������ �־�� �Ѵ�.</p>
<example>
&lt;!--#include virtual="/footer.html" --&gt;
</example>
<p>���� ���� �� �ΰ����� ���ļ� ������ ������ �ϴ� ���Ͽ�
<code>LAST_MODIFIED</code> ���þ �ִ´�. �����Ϸ��� ���Ͽ���
SSI ���þ ���� �� ������, �̷��� ������ ������ �ٸ� ������
�����ϴ� ������ ������ ��� ������ ���� �ִ�.</p>
</section>
</section>
<section id="config">
<title>�̿ܿ� ������ �� �ִ� ����?</title>
<p>�ð� ��� <code>config</code>(����) �ܿ� �ΰ����� ��
<code>config</code>(����)�� �� �ִ�.</p>
<p>���� SSI ���þ �߸�Ǹ� ������ ���� ������ ���´�</p>
<example>
[an error occurred while processing this directive]
</example>
<p>�� ������ �����ϰ� �ʹٸ� <code>config</code> element��
<code>errmsg</code> attribute�� ����Ͽ� �����Ѵ�.</p>
<example>
&lt;!--#config errmsg="[It appears that you don't know how to use SSI]" --&gt;
</example>
<p>����Ʈ�� �����ϱ� �� ��� SSI ���þ� ������ �ذ��Ͽ�
����ڰ� �̷� ������ ���� �ʱ� �ٶ���. (�׷���?)</p>
<p>�׸��� <code>sizefmt</code> attribute�� ��ȯ�ϴ� ����ũ��
����� <code>config</code>(����)�� �� �ִ�. ����Ʈ�� ũ�⸦
�����ַ��� <code>bytes</code>, ������ Kb�� Mb�� ũ�⸦
�����ַ��� <code>abbrev</code>�� ����Ѵ�.</p>
</section>
<section id="exec">
<title>��ɾ� �����ϱ�</title>
<p>���� ���� �޿� ���� CGI ���α׷��� SSI�� ���� ����ϴ�
���� �� �����̴�. ������ <code>exec</code> element�� ��
�� �ִ� �ٸ� �͵��� ������ ���̴�. SSI�� ���� ���� (��Ȯ����
<code>/bin/sh</code>�� Win32�� ����Ѵٸ� DOS ��) ����Ͽ�
��ɾ �����Ѵ�. ���� ���, ������ ���丮 ����� �����ش�.</p>
<example>
&lt;pre&gt;<br />
&lt;!--#exec cmd="ls" --&gt;<br />
&lt;/pre&gt;
</example>
<p>or, on Windows</p>
<example>
&lt;pre&gt;<br />
&lt;!--#exec cmd="dir" --&gt;<br />
&lt;/pre&gt;
</example>
<p><code>dir</code> ��¿� ������ ȥ����
``&lt;<code>dir</code>&gt;'' ���ڿ��� ���Ե��ֱ⶧����,
��������� �� ���þ ����ϸ� ��� ���� �̻��� ���̴�.</p>
<p>�� ����� <code>exec</code> �±׿� ����� � ��ɾ��
������ �� �ֱ⶧���� �ſ� �����ϴ�. ``����''�� ���� ����ڰ�
�������� ������ ������ �� �ִ� ȯ���̶��, �� ����� ����
����ؼ� �ȵȴ�. <code>Options</code> ���þ
<code>IncludesNOEXEC</code> �ƱԸ�Ʈ�� ����Ͽ� SSI�� ���������
<code>exec</code> ����� ���� �� �ִ�.</p>
</section>
<section id="advanced">
<title>��� SSI ���</title>
<p>������ ����ϴ� ��� �ܿ� ����ġ SSI�� ���� ������ �����ϰ�,
�񱳹��� ���ǹ��� �� ������ ����� �� �ִ�.</p>
<section id="caveat"><title>���</title>
<p>�� �ۿ��� �����ϴ� ��κ��� ����� ����ġ 1.2 ���ĺ���
����� �� �ִ�. ����, ����ġ 1.2 �̻��� ������� �ʴ´ٸ�
�Ƹ��� ���� ���׷��̵��ؾ� �Ѵ�. �ض�. ���� �ض�. ��ٸ�
���̴�.</p>
</section>
<section id="variables"><title>���� ����</title>
<p><code>set</code> ���þ ����Ͽ� ���߿� ����� ������
������ �� �ִ�. ������ ������ �ʿ��ϱ⶧���� ���� �����Ѵ�.
������ ������ ����.</p>
<example>
&lt;!--#set var="name" value="Rich" --&gt;
</example>
<p>������ ���� ���� ���ڱ״�� �������� �ʰ� <a
href="/env.html">ȯ�溯��</a>�� ������ ������ ����(����
���, <code>LAST_MODIFIED</code>)�� ���� �ٸ� ������ ����Ͽ�
�������� ������ ���� �ִ�. �̶� ������ �տ� �޷� ǥ��($)��
�ٿ��� ���ڿ��� �ƴ� �������� ǥ���Ѵ�.</p>
<example> &lt;!--#set var="modified" value="$LAST_MODIFIED" --&gt;
</example>
<p>�������� �޷� ���ڸ� �״�� �Է��Ϸ��� �޷� ǥ�� �տ�
�齽������ ����Ѵ�.</p>
<example>
&lt;!--#set var="cost" value="\$100" --&gt;
</example>
<p>���������� �� ���ڿ� �߰��� ������ ����ϴµ� �ڿ� �ִ�
���ڵ� ���������� �����Ͽ� ȥ���Ǵ� ���, �������� ���ȣ��
��� Ȯ���� �Ѵ�. (���� ���� ã�� �������, ���� ������
�����ϱ� �ٶ���.)</p>
<example>
&lt;!--#set var="date" value="${DATE_LOCAL}_${DATE_GMT}" --&gt;
</example>
</section>
<section id="conditional">
<title>���� ǥ����</title>
<p>������ �����ϰ� ���� �� ������ ���ǹ��� �����ϴ�. ����
SSI�� ������ ������ ���α׷��־� �ȴ�.
<module>mod_include</module>�� ���ǹ��� ����� <code>if</code>,
<code>elif</code>, <code>else</code>, <code>endif</code>
������ �����Ѵ�. ���� �� �������� ���� �?���� ��������
���� �� �ִ�.</p>
<p>���ǹ� ������ ������ ����.</p>
<example>
&lt;!--#if expr="test_condition" --&gt;<br />
&lt;!--#elif expr="test_condition" --&gt;<br />
&lt;!--#else --&gt;<br />
&lt;!--#endif --&gt;
</example>
<p><em>test_condition</em>���� � �?�񱳶� �����
�� �ִ�. ���� �ٸ� ���� ���ϰų�, Ư�� ���� ``��''����
�˻��Ѵ�. (���ڿ��� ������� ������ ���̴�.) ��밡����
�� �����ڸ� ��� ������, <module>mod_include</module>
������ ����϶�. ������ ���ǹ��� ����� ��� ������.</p>
<p>�������Ͽ� ���� ���� �߰��Ѵ�.</p>
<example>
BrowserMatchNoCase macintosh Mac<br />
BrowserMatchNoCase MSIE InternetExplorer
</example>
<p>Ŭ���̾�Ʈ�� ��Ų��ÿ��� �����ϴ� Internet Explorer���
ȯ�溯�� ``Mac''�� ``InternetExplorer'' ��� ������ �����Ѵ�.</p>
<p>�׸��� SSI ������ ������ ���� ��´�.</p>
<example>
&lt;!--#if expr="${Mac} &amp;&amp; ${InternetExplorer}" --&gt;<br />
���⿡ ��� ���´�<br />
&lt;!--#else --&gt;<br />
���⿡ ���� JavaScript �ڵ尡 ���´�<br />
&lt;!--#endif --&gt;
</example>
<p>���� ��Ų��� IE�� �ݰ��� �ִ� ���� �ƴϴ�. ���� ����
����ֿ� �ٸ� �������� ������ ��� JavaScript �ڵ尡 ��Ų���
IE������ �������� �ʾƼ� ��ð��� ����ߴ�. ���� �ӽ�
�ذ�å�̴�.</p>
<p>(���� �����Ͽ��� �Ϲ� ȯ�溯���̰�) � ������ ���ǹ���
����� �� �ִ�. �ƶ�ġ�� <code>SetEnvIf</code>�� �ٸ� ���
���þ�� ȯ�溯���� ������ �� �ֱ⶧���� CGI ���̵� ������
������ ������ ���� �� �ִ�.</p>
</section>
</section>
<section id="conclusion"><title>���</title>
<p>SSI�� Ȯ���� CGI�� ������ ���������� ���ϴ� �ٸ� �����
��ü�� �� ���. �׷��� ���� �߰� �۾����� �������� ������
������ ���� �߰��ϱ⿡�� �Ǹ��� ����̴�.</p>
</section>
</manualpage>