����ġ ���丮��: Server Side Includes �Ұ� (original) (raw)
�� ������ �ֽ��� ������ �ƴմϴ�. �ֱٿ� ����� ������ ���� ������ �����ϼ���.
Server-side includes�� ����Ͽ� HTML ������ ������ ������ �߰��� �� �ִ�.
����
�Ұ�
�� ���� ���� SSI��� �θ��� Server Side Includes�� �����Ѵ�. SSI�� �����ϵ��� ������ �����ϴ� ����� HTML �������� ������ ������ �߰��ϴ� �⺻���� SSI ������ �Ұ��Ѵ�.
�� ���� �κ��� SSI ���þ� ���ǹ��� ���� ���ޱ���� �����Ѵ�.
SSI�� ������
SSI (Server Side Includes)�� HTML �������� ����ϴ� ���þ��, �������� �����Ҷ� ������ ó���Ѵ�. SSI�� ����ϸ� CGI ���α��̳� �ٸ� ������ ����� ������ ��ü�� ���� �������� �ʰ��� HTML �������� �������� ������ ������ �߰��� �� �ִ�.
SSI�� ������� �ƴϸ� ���α����� ������ ��ü�� �������� ������ ���������� ������ �κ��� �������� �������� ������ ������ ��������� �ٽ� ����ؾ������� �ȴ�. SSI�� ���� �ð��� ���� ���� ������ �߰��ϴµ� ����. ���� �������� �����Ҷ� �������� ��κ��� �����ؾ� �Ѵٸ� �ٸ� ����� ã�ƺ��� �Ѵ�.
SSI�� �����ϵ��� ���� �����ϱ�
������ SSI�� ó���Ϸ��� httpd.conf
�����̳�.htaccess
���Ͽ��� ���� ���þ ����ؾ� �Ѵ�.
Options +Includes
���� ����ġ�� ���Ͽ��� SSI ���þ ó���Ѵ�. �������� ���� ���� [Options](../mod/core.html#options)
���þ �ְ�, �� ���þ���� ���� ����Ἥ ��ȿ�� �����. ���� ���þ �Ǹ������� ó���ϱ����� ���� SSI�� ���ϴ� Ư�� ���丮���� Options
�� ����Ѵ�.
��� ���Ͽ��� SSI ���þ ó���ϴ� ���� �ƴϴ�. ����ġ���� � ������ ó������ �˷���� �Ѵ�. �ΰ��� ����� �ִ�. �ϳ��� ������ ���� ���þ�� .shtml
�� ���� Ư�� ���� Ȯ���ڸ� ���� ������ ó���ϴ� ����̴�.
AddType text/html .shtml AddOutputFilter INCLUDES .shtml
�� ����� ������ �̹� �ִ� �������� SSI ���þ �߰��ϴ� ��� SSI ���þ ó���ϱ����� .shtml
Ȯ���ڸ� �ο��ϱ���� ���ϸ��� �� �������� ��� ��ũ�� �����ؾ� �ϴ� ���̴�.
�ٸ� ����� [XBitHack](../mod/mod%5Finclude.html#xbithack)
���þ ����ϴ� ����̴�.
XBitHack on
[XBitHack](../mod/mod%5Finclude.html#xbithack)
�� ��������� �ִ� ���Ͽ��� SSI ���þ ó���Ѵ�. ���� �̹� �ִ� �������� SSI ���þ �߰��Ѵٸ� ���ϸ��� �������� �ʰ� chmod
�� ���Ͽ� ��������� �ָ� �ȴ�.
chmod +x pagename.html
���� ���ƾ� �� �� �ϳ�. ���� .shtml
���ϸ��� ��ġ�� �������� ��� .html
������ SSI ó���϶�� ����ϴ� ����� �ִ�. �� ������� �Ƹ��� [XBitHack](../mod/mod%5Finclude.html#xbithack)
�� ���� �� �� ����. ������ ���� �̷��� �ϸ� ����ġ�� ���Ͽ� SSI ���þ ������ Ŭ���̾�Ʈ�� ������ ��� ������ ������� �Ѵٴ� ���̴�. ������ �ſ� ������ �� ������, ���� ������ �ƴϴ�.
���� ����������� ��������̶� ���� ������� ���ڸ� ����� �� ����.
������ �����̿��� ����ϱ� ��Ʊ���� ����ġ �⺻ ������ SSI �������� �ֱټ����ϰ� content length HTTP ����� ������ �ʴ´�. ���� ������ ij������ ���ϰ� Ŭ���̾�Ʈ�� ������ ������ ��������. �ΰ��� �ذ����� �ִ�.
XBitHack Full
������ ����Ѵ�. ���� ����ġ�� �����ϴ�(include) ���ϵ��� �������� ������ü ���� ��û�� ������ ��¥�� ���� �ֱټ������� �˾Ƴ���.[mod_expires](../mod/mod%5Fexpires.html)
�� �ִ� ���þ ����Ͽ� ���Ͽ� ���� �������� �����ϸ� �������� ���Ͻð� ������ ij���� �� �ִ�.
�⺻ SSI ���þ�
SSI ���þ��� ������ ������ ����.
<!--#element attribute=value attribute=value ... -->
HTML �ּ����� �������� SSI ����� �������� �ʾƵ� HTML �ҽ����� �������� �������� �����Ѵ�. SSI�� �ùٷ� �����ϸ� ���þ ��������� �ٲ۴�.
element�� ������ �ϳ���. ���� ȸ�� �� �ڼ��� ������ ���̴�. ������ SSI�� �� �� �ִ� ��� ���� ���δ�
���� ��¥
<!--#echo var="DATE_LOCAL" -->
echo
element�� �������� �״�� ����Ѵ�. CGI ���α��� �����ϴ� ȯ�溯���� �ܿ��� ���� ǥ�� ������ �ִ�. ��, set
element�� ����Ͽ� ���� ������ ������ ���� �ִ�.
��¥ ��� ������ ������ ���� �ʴ´ٸ�, ������ ����config
element�� timefmt
attribute�� ����Ѵ�.
<!--#config timefmt="%A %B %d, %Y" --> Today is <!--#echo var="DATE_LOCAL" -->
������ ������
�� ������ <!--#flastmod file="index.html" -->�� ���������� �����Ǿ���
�� element�� timefmt
���� ������ �ȴ�.
CGI ���α� ����� �����ϱ�
�Ϲ����� SSI ������ �ϳ���, ���̵� �ֿ��ϴ� ``�湮�� ī����'' ���� CGI ���α� ����� ����Ѵ�.
<!--#include virtual="/cgi-bin/counter.pl" -->
�߰� ����
������ HTML ������ ����� �� �ִ� ��� SSI ������.
�� ������ ���� ���������� �����Ǿ���?
�տ��� SSI�� ����Ͽ� ����ڿ��� ������ �ֱټ������� �˸� �� �ִٰ� ���ߴ�. ���� ���� ����� �˷����� �ʾҴ�. ���� �ڵ带 HTML ������ ����ϸ� �������� �ð� ����� �����. ���� ������ �����Ѵ�� SSI�� �ùٷ� �۵��ؾ� �Ѵ�.
<!--#config timefmt="%A %B %d, %Y" --> �� ������ <!--#flastmod file="ssi.shtml" -->�� ���������� �����Ǿ���;
���� ssi.shtml
��� ���ϴ� ���� ���ϸ��� ����Ѵ�. �ƹ� ���������� �ٿ����� �� �ִ� �����ڵ带 ���Ѵٸ�, ���ϸ� ��� LAST_MODIFIED
������ ����Ѵ�.
<!--#config timefmt="%D" --> This file last modified <!--#echo var="LAST_MODIFIED" -->
timefmt
���Ŀ� ���� �ڼ��� ������ �˻���������strftime
�� ã�ƺ���. ������ ����.
ǥ�� ������ �ϴ��� �����ϱ�
���� �������� �ִ� ����Ʈ�� �����Ѵٸ� ������ ��ü�� �����ϴ� ����, Ư�� ���������� ǥ�� �ܰ��� �������� �����ϴ� ���� ������ ���Ӵ�.
������ ���(header)�� �ϴ�(footer)�� ���Ϸ� �����Ͽ� �̷� ������ �δ��� �� �� �ִ�. ��� ����������include
SSI ���ɾ ����Ͽ� ������ �ϴ� ���� �ϳ��� �����ϸ� �ȴ�. include
element��file
attribute�� virtual
attribute�� ������ ������ �����Ѵ�. file
attribute�� ���� ���丮�� ������� ���ϰ�δ�. ��, (/�� �����ϴ�) �������ϰ�γ� ��� �ȿ� ../�� ����� �� ����. �Ƹ��� �����ϴ� ������ ��� URL�� ������ �� �ִ� virtual
attribute�� �� ������ ���̴�. ��θ� /�� ������ �� ������, �����Ϸ��� ������ �����ϴ� ���ϰ� ���� ������ �־�� �Ѵ�.
<!--#include virtual="/footer.html" -->
���� ���� �� �ΰ����� ���ļ� ������ ������ �ϴ� ���Ͽ�LAST_MODIFIED
���þ �ִ´�. �����Ϸ��� ���Ͽ��� SSI ���þ ���� �� ������, �̷��� ������ ������ �ٸ� ������ �����ϴ� ������ ������ ��� ������ ���� �ִ�.
�̿ܿ� ������ �� �ִ� ����?
�ð� ���� config
(����) �ܿ� �ΰ����� ��config
(����)�� �� �ִ�.
���� SSI ���þ �߸��Ǹ� ������ ���� ������ ���´�
[an error occurred while processing this directive]
�� ������ �����ϰ� �ʹٸ� config
element��errmsg
attribute�� ����Ͽ� �����Ѵ�.
<!--#config errmsg="[It appears that you don't know how to use SSI]" -->
����Ʈ�� �����ϱ� ���� ��� SSI ���þ� ������ �ذ��Ͽ� ����ڰ� �̷� ������ ���� �ʱ� �ٶ���. (����?)
���� sizefmt
attribute�� ��ȯ�ϴ� ����ũ�� ������ config
(����)�� �� �ִ�. ����Ʈ�� ũ�⸦ �����ַ��� bytes
, ������ Kb�� Mb�� ũ�⸦ �����ַ��� abbrev
�� ����Ѵ�.
���ɾ� �����ϱ�
���� ���� �� ���� CGI ���α��� SSI�� ���� ����ϴ� ���� �� �����̴�. ������ exec
element�� �� �� �ִ� �ٸ� �͵��� ������ ���̴�. SSI�� ���� ���� (��Ȯ����/bin/sh
�� Win32�� ����Ѵٸ� DOS ��) ����Ͽ� ���ɾ �����Ѵ�. ���� ���, ������ ���丮 ����� �����ش�.
<pre> <!--#exec cmd="ls" --> </pre>
or, on Windows
<pre> <!--#exec cmd="dir" --> </pre>
dir
��¿� �������� ȥ���� ``<dir
>'' ���ڿ��� ���Ե��ֱ����, ��������� �� ���þ ����ϸ� ����� ���� �̻��� ���̴�.
�� ����� exec
�±� ����� � ���ɾ�� ������ �� �ֱ���� �ſ� �����ϴ�. ``�����''�� ���� ����ڰ� �������� ������ ������ �� �ִ� ȯ���̶��, �� ����� ����� ����ؼ� �ȵȴ�. Options
���þIncludesNOEXEC
�ƱԸ�Ʈ�� ����Ͽ� SSI�� ���������exec
����� ���� �� �ִ�.
���� SSI ���
������ ����ϴ� ��� �ܿ� ����ġ SSI�� ���� ������ �����ϰ�, ���� ���ǹ��� �� ������ ����� �� �ִ�.
���
�� �ۿ��� �����ϴ� ��κ��� ����� ����ġ 1.2 ���ĺ��� ����� �� �ִ�. ����, ����ġ 1.2 �̻��� ������� �ʴ´ٸ� �Ƹ��� ���� �����̵��ؾ� �Ѵ�. �ض�. ���� �ض�. ��ٸ� ���̴�.
���� ����
set
���þ ����Ͽ� ���߿� ����� ������ ������ �� �ִ�. ������ ������ �ʿ��ϱ���� ���� �����Ѵ�. ������ ������ ����.
<!--#set var="name" value="Rich" -->
������ ���� ���� ���ڱ״�� �������� �ʰ� ȯ�溯���� ������ ������ ����(���� ���, LAST_MODIFIED
)�� ���� �ٸ� ������ ����Ͽ� �������� ������ ���� �ִ�. �̶� ������ �տ� �� ǥ��($)�� �ٿ��� ���ڿ��� �ƴ� �������� ǥ���Ѵ�.
<!--#set var="modified" value="$LAST_MODIFIED" -->
�������� �� ���ڸ� �״�� �Է��Ϸ��� �� ǥ�� �տ� �齽������ ����Ѵ�.
<!--#set var="cost" value="\$100" -->
���������� �� ���ڿ� �߰��� ������ ����ϴµ� �ڿ� �ִ� ���ڵ� ���������� �����Ͽ� ȥ���Ǵ� ���, �������� ���ȣ�� ��� Ȯ���� �Ѵ�. (���� ���� ã�� ��������, ���� ������ �����ϱ� �ٶ���.)
<!--#set var="date" value="${DATE_LOCAL}_${DATE_GMT}" -->
���� ǥ����
������ �����ϰ� ���� �� ������ ���ǹ��� �����ϴ�. ���� SSI�� ������ ������ ���α��־� �ȴ�.[mod_include](../mod/mod%5Finclude.html)
�� ���ǹ��� ����� if
,elif
, else
, endif
������ �����Ѵ�. ���� �� �������� ���� �������� �������� ���� �� �ִ�.
���ǹ� ������ ������ ����.
<!--#if expr="test_condition" --> <!--#elif expr="test_condition" --> <!--#else --> <!--#endif -->
_test_condition_���� � ������ ����� �� �ִ�. ���� �ٸ� ���� ���ϰų�, Ư�� ���� ``��''���� �˻��Ѵ�. (���ڿ��� ������� ������ ���̴�.) ��밡���� �� �����ڸ� ��� ������, [mod_include](../mod/mod%5Finclude.html)
������ �����϶�. ������ ���ǹ��� ����� ��� ������.
�������Ͽ� ���� ���� �߰��Ѵ�.
BrowserMatchNoCase macintosh Mac BrowserMatchNoCase MSIE InternetExplorer
Ŭ���̾�Ʈ�� ��Ų��ÿ��� �����ϴ� Internet Explorer��� ȯ�溯�� ``Mac''�� ``InternetExplorer'' ��� ������ �����Ѵ�.
���� SSI ������ ������ ���� ���´�.
<!--#if expr="${Mac} && ${InternetExplorer}" --> ��� ������� ���´� <!--#else --> ��� ���� JavaScript �ڵ尡 ���´� <!--#endif -->
���� ��Ų��� IE�� �ݰ��� �ִ� ���� �ƴϴ�. ���� ���� �����ֿ� �ٸ� �������� ������ ���� JavaScript �ڵ尡 ��Ų��� IE������ �������� �ʾƼ� ��ð��� �����ߴ�. ���� �ӽ� �ذ�å�̴�.
(���� �����Ͽ��� �Ϲ� ȯ�溯���̰�) � ������ ���ǹ��� ����� �� �ִ�. �ƶ�ġ�� SetEnvIf
�� �ٸ� ���� ���þ�� ȯ�溯���� ������ �� �ֱ���� CGI ���̵� ������ ������ ������ ���� �� �ִ�.
���
SSI�� Ȯ���� CGI�� ������ ���������� �����ϴ� �ٸ� ����� ��ü�� �� ����. ���� ���� �߰� �۾����� �������� ������ ������ ���� �߰��ϱ�� �Ǹ��� ����̴�.