mass.xml.ko revision dcfd71cf8c1fd0e1f2563197a68a07e14a9e3387
<?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: 1.5 (outdated: 1.9) -->
<!--
Copyright 2003-2004 The Apache Software Foundation
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="mass.xml.meta">
<parentdocument href="./">����ȣ��Ʈ</parentdocument>
<title>�뷮�� ����ȣ��Ʈ�� �������� �����ϱ�</title>
<summary>
<p>�� ������ ����ġ 1.3���� �뷮�� ����ȣ��Ʈ�� ȿ��������
�����ϴ� ����� �����Ѵ�. <!--
Written by Tony Finch (fanf@demon.net) (dot@dotat.at).
Some examples were derived from Ralf S. Engleschall's document
http://www.engelschall.com/pw/apache/rewriteguide/
Some suggestions were made by Brian Behlendorf.
-->
</p>
</summary>
<section id="motivation"><title>����</title>
<p>����� <code>httpd.conf</code>�� ������ ���� ���� �����
<code>&lt;VirtualHost&gt;</code> ���ǵ��� ���� �ִٸ� ���⼭
�����ϴ� ����� ������ �� ���̴�:</p>
<example>
NameVirtualHost 111.22.33.44<br />
&lt;VirtualHost 111.22.33.44&gt;<br />
<indent>
ServerName www.customer-1.com<br />
DocumentRoot /www/hosts/www.customer-1.com/docs<br />
ScriptAlias /cgi-bin/ /www/hosts/www.customer-1.com/cgi-bin<br />
</indent>
&lt;/VirtualHost&gt;<br />
&lt;VirtualHost 111.22.33.44&gt;<br />
<indent>
ServerName www.customer-2.com<br />
DocumentRoot /www/hosts/www.customer-2.com/docs<br />
ScriptAlias /cgi-bin/ /www/hosts/www.customer-2.com/cgi-bin<br />
</indent>
&lt;/VirtualHost&gt;<br />
# �ٺ� �ٺ� �ٺ�<br />
&lt;VirtualHost 111.22.33.44&gt;<br />
<indent>
ServerName www.customer-N.com<br />
DocumentRoot /www/hosts/www.customer-N.com/docs<br />
ScriptAlias /cgi-bin/ /www/hosts/www.customer-N.com/cgi-bin<br />
</indent>
&lt;/VirtualHost&gt;
</example>
<p>�⺻ ������ ������ <code>&lt;VirtualHost&gt;</code>
���� ��θ� �������� ó���ϵ��� ��ü�ϴ� ���̴�.
�׷��� ���� ������ �ִ�:</p>
<ol>
<li>���������� �۾����� ����ġ�� ���� �����ϰ� �޸𸮸�
��� ����Ѵ�.</li>
<li>����ȣ��Ʈ�� �߰��ϱ����� ���Ͻý��ۿ� �����
���丮�� ����� DNS�� �׸��� �߰��ϱ⸸ �ϸ�ȴ�. ��,
����ġ�� �缳���ϰ� ������� �ʿ䰡 ���.</li>
</ol>
<p>������ �� ����ȣ��Ʈ���� �ٸ� �α������� ����� �� ��ٴ�
���̴�. �׷��� �ſ� ���� ����ȣ��Ʈ�� ����Ѵٸ� ���ϱ���ڸ�
�� ������⶧���� ���� �ٸ� �α������� ����� �� ���. ��������
fifo�� �α׸� ������, �޴� �?�� �α׸� ó���Ͽ� ������
����� (��� ���� ���� ���� �ִ�) �� ����.</p>
</section>
<section id="overview"><title>����</title>
<p>����ȣ��Ʈ�� IP �ּҿ� HTTP ��û�� <code>Host:</code>
��� ������ �����Ѵ�. �⺻������ �뷮��
���� ����ȣ��Ʈ ����� �ڵ����� ����ȣ��Ʈ ������ ��û��
���ϰ�ο� �����Ѵ�. �̴� ��κ� <module>mod_vhost_alias</module>��
����Ͽ� ���� �ذ��� �� ������, ����ġ 1.3.6 ���ϸ� ����Ѵٸ�
<module>mod_rewrite</module>�� ����ؾ� �Ѵ�. �� �� ���
��� �⺻������ ������ ���Ե��� �ʴ´�. �� ����� ����Ϸ���
����ġ�� �����ϰ� �������Ҷ� �����ؾ� �Ѵ�.</p>
<p>���� ����ȣ��Ʈ�� �Ϲ����� ����ȣ��Ʈó�� ���̰��Ϸ���
���������� `�ӿ���' �Ѵ�. ���� �߿��� ���� ����ġ�� �ڱ�����
URL ���� ���鶧 ����� �������̴�. ��������
<code>ServerName</code> ���þ�� �����ϸ�, CGI����
<code>SERVER_NAME</code> ȯ�溯���� �־����. ������ ����
�������� <directive
module="core">UseCanonicalName</directive> ������ �޷ȴ�.
<code>UseCanonicalName Off</code>�̸� ��û�� <code>Host:</code>
��� ������ �������� �ȴ�. <code>UseCanonicalName DNS</code>�̸�
����ȣ��Ʈ�� IP �ּҸ� ��DNS �˻��Ͽ� �������� �˾Ƴ���.
���ڴ� �̸���� ���� ����ȣ��Ʈ���� ����ϰ�, ���ڴ� IP���
����ȣ��Ʈ���� ����Ѵ�. <code>Host:</code> ����� ��ų�
DNS �˻��� �����Ͽ� ����ġ�� �������� �˾Ƴ��� ���ϸ�
<code>ServerName</code>���� ������ ���� ��� ����Ѵ�.</p>
<p>�ٸ� `����' ���� (<code>DocumentRoot</code>�� �����ϸ�,
CGI���� <code>DOCUMENT_ROOT</code> ȯ�溯���� �־�����)
������Ʈ�̴�. �Ϲ����� ��� core ����� �� ������ ����Ͽ�
URI�� �ش��ϴ� ���ϸ��� ã����, ������ ���� ����ȣ������ �Ҷ��� �ٸ�
����� (<code>mod_vhost_alias</code>�� <code>mod_rewrite</code>)
�ٸ� ������� �̷� �۾��� �Ѵ�. �� ��� ���
<code>DOCUMENT_ROOT</code> ȯ�溯���� ������� �����Ƿ�
CGI�� SSI ������ �� ���� ����Ѵٸ� �߸�� ��� ���� ��
�ִ�.</p>
</section>
<section id="simple"><title>������ ���� ����ȣ��Ʈ</title>
<p>�� <a href="#motivation">����</a> ���� ����ȣ��Ʈ
������ <code>mod_vhost_alias</code>�� ����Ͽ� �� �Ϲ�������
�����ߴ�.</p>
<example>
# Host: ������� �������� �˾Ƴ���<br />
UseCanonicalName Off<br />
<br />
# ù��° �ʵ带 ����Ͽ� �� �α׸� ����ȣ��Ʈ���� ���� �� �ִ�<br />
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon<br />
CustomLog logs/access_log vcommon<br />
<br />
# ��û�� ó���ϱ����� ���ϸ? �������� �����Ѵ�<br />
VirtualDocumentRoot /www/hosts/%0/docs<br />
VirtualScriptAlias /www/hosts/%0/cgi-bin
</example>
<p>�� �������� <code>UseCanonicalName Off</code>��
<code>UseCanonicalName DNS</code>�� �����ϱ⸸ �ϸ� IP���
����ȣ��Ʈ�� �ȴ�. ����ȣ��Ʈ�� IP �ּҸ� ������
���ϸ? �߰��� �������� �� �� �ִ�.</p>
</section>
<section id="homepages"><title>�������� ȣ��Ʈ�ϴ� Ȩ������ �ý���</title>
<p>ISP Ȩ������ ������ ���� ���� ������ �����ߴ�. ���� ��
������ ������ ����ϸ� <code>www.user.isp.com</code>�� ������
<code>/home/user/</code>�� �δ� ������ �������� �Ϻθ� ������
���ϸ��� ���� �� �ִ�. �� ������
<code>cgi-bin</code>�� �� ����ȣ��Ʈ�� ��� �������ʰ�
��� ����ȣ��Ʈ�� ���� ����Ѵ�.</p>
<example>
# �⺻���� ������ ���� ����. �׸���<br />
<br />
# ���ϸ? �������� �Ϻθ� �����Ѵ�<br />
VirtualDocumentRoot /www/hosts/%2/docs<br />
<br />
# �ϳ��� cgi-bin ���丮<br />
ScriptAlias /cgi-bin/ /www/std-cgi/<br />
</example>
<p><module>mod_vhost_alias</module> �������� �� ������
<code>VirtualDocumentRoot</code> ������ ���� �ִ�.</p>
</section>
<section id="combinations"><title>�� ������ ���� ����ȣ��Ʈ
�ý��� ����ϱ�</title>
<p>�� ������ ������ ���� ����ġ�� �Ϲ�����
<code>&lt;VirtualHost&gt;</code> ���þ ����Ͽ� ����
����ȣ��Ʈ ������ ������ ������ �� �ִ�. ���� ���, ������
���� ������ Ȩ������ �?�� IP �ּ� �Ѱ�, �������
�?���� �ٸ� IP �ּ� �Ѱ��� �ο��Ѵ�. ���� ����ó��
<code>&lt;VirtualHost&gt;</code> ���� ���ǿ� ��� ���� ����
�ִ�.</p>
<example>
UseCanonicalName Off<br />
<br />
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon<br />
<br />
&lt;Directory /www/commercial&gt;<br />
<indent>
Options FollowSymLinks<br />
AllowOverride All<br />
</indent>
&lt;/Directory&gt;<br />
<br />
&lt;Directory /www/homepages&gt;<br />
<indent>
Options FollowSymLinks<br />
AllowOverride None<br />
</indent>
&lt;/Directory&gt;<br />
<br />
&lt;VirtualHost 111.22.33.44&gt;<br />
<indent>
ServerName www.commercial.isp.com<br />
<br />
CustomLog logs/access_log.commercial vcommon<br />
<br />
VirtualDocumentRoot /www/commercial/%0/docs<br />
VirtualScriptAlias /www/commercial/%0/cgi-bin<br />
</indent>
&lt;/VirtualHost&gt;<br />
<br />
&lt;VirtualHost 111.22.33.45&gt;<br />
<indent>
ServerName www.homepages.isp.com<br />
<br />
CustomLog logs/access_log.homepages vcommon<br />
<br />
VirtualDocumentRoot /www/homepages/%0/docs<br />
ScriptAlias /cgi-bin/ /www/std-cgi/<br />
</indent>
&lt;/VirtualHost&gt;
</example>
</section>
<section id="ipbased"><title>�� ȿ������ IP��� ����ȣ��Ʈ</title>
<p><a href="#simple">ù��° ��</a>���� ���� ������ ������
IP��� ����ȣ��Ʈ�� �ٲ� �� �ִٰ� ���ߴ�. ��������
�׷� ������ �� ��û���� DNS�� ã�ƾ��ϹǷ� �ſ� ��ȿ�����̴�.
�̸���� IP �ּҷ� ���Ͻý����� �����ϰ� ���� �������
�α׸� �����ϸ� ������ �ذ��� �� �ִ�. ����ġ�� ��������
�ٷ� �ʿ䰡 �������, DNS �˻��� ���� �ʰ� �ȴ�.</p>
<example>
# IP �ּҸ� ��DNS �˻��Ͽ� �������� �˾Ƴ���<br />
UseCanonicalName DNS<br />
<br />
# �α׸� ���� �� �ֵ��� IP �ּҸ� �����Ѵ�<br />
LogFormat "%A %h %l %u %t \"%r\" %s %b" vcommon<br />
CustomLog logs/access_log vcommon<br />
<br />
# ���ϸ? IP �ּҸ� �����Ѵ�<br />
VirtualDocumentRootIP /www/hosts/%0/docs<br />
VirtualScriptAliasIP /www/hosts/%0/cgi-bin<br />
</example>
</section>
<section id="oldversion"><title>����ġ ���� ���� ����ϱ�</title>
<p>�� ������ ����ġ ���� 1.3.6 ���Ŀ� ���Ե�
<code>mod_vhost_alias</code>�� ����Ѵ�.
<code>mod_vhost_alias</code>�� ��� ����ġ ������ ����Ѵٸ�
�̹� ���ߵ��� <code>mod_rewrite</code>�� ����Ͽ�, ��
Host:-������ ����ȣ��Ʈ����, ������ �� �ִ�.</p>
<p>�� �α׿� ���Ͽ� ������ ���� �ִ�. ����ġ 1.3.6����
�α���� ���þ� <code>%V</code>�� ���ԵǾ��, ���� 1.3.0
- 1.3.3���� �� ����� <code>%v</code> �ɼ��� ��� �ߴ�. �׷���
���� 1.3.4���� �̷� ����� ���. � ����ġ �����
<code>.htaccess</code> ���Ͽ��� <code>UseCanonicalName</code>
���þ ����� �� �����Ƿ� �α׿� �̻��� ������ ��ϵ� �� �ִ�.
�׷��Ƿ� ���� ���� ����� <code>%{Host}i</code> ���þ
����Ͽ� <code>Host:</code> ����� ���� �α׿� ����� ���̴�.
��, �� ����� <code>%V</code>�� ���������ʴ� <code>:port</code>��
�ڿ� �߰��� �� �ִ�.</p>
</section>
<section id="simple.rewrite"><title><code>mod_rewrite</code>��
����� ������ ���� ����ȣ��Ʈ</title>
<p>������ <a href="#simple">ù��° ��</a>�� ���� ���� �ϴ�
<code>httpd.conf</code> ���̴�. ó�� ����� ù��° ����
���� ���������, ���� ������� ȣȯ���� <code>mod_rewrite</code>��
������ ������ ���� �����Ǿ��. ������ ����� ���� �۾���
�ϴ� <code>mod_rewrite</code>�� �����Ѵ�.</p>
<p>Ư���� �����ؾ� �� ������ �ִ�. �⺻������
<code>mod_rewrite</code>�� (<code>mod_alias</code> ��) �ٸ�
URI �� ��� ���� ����ȴ�. �׷��� �ٸ� URI �� �����
���� ������ ���� ����Ͽ� <code>mod_rewrite</code>�� �����ؾ� �Ѵ�.
��, ���� ����ȣ��Ʈ���� <code>ScriptAlias</code>�� ����
����� ���ؼ��� Ư���� �۾��� �ʿ��ϴ�.</p>
<example>
# Host: ������� �������� ��´�<br />
UseCanonicalName Off<br />
<br />
# splittable logs<br />
LogFormat "%{Host}i %h %l %u %t \"%r\" %s %b" vcommon<br />
CustomLog logs/access_log vcommon<br />
<br />
&lt;Directory /www/hosts&gt;<br />
<indent>
# ScriptAlias ������ CGI ������ ������ �� ��⶧����<br />
# ���⿡ ExecCGI�� ����Ѵ�<br />
Options FollowSymLinks ExecCGI<br />
</indent>
&lt;/Directory&gt;<br />
<br />
# ���� ����� �κ��̴�<br />
<br />
RewriteEngine On<br />
<br />
# Host: ������� ������ �����?�� ��ҹ��ڰ� �ڼ������� �� �ִ�<br />
RewriteMap lowercase int:tolower<br />
<br />
## �Ϲ� ������ ���� ó���Ѵ�:<br />
# Alias /icons/ �� �����ϵ��� - �ٸ� alias�� ���ؼ��� �ݺ�<br />
RewriteCond %{REQUEST_URI} !^/icons/<br />
# CGI�� �����ϵ���<br />
RewriteCond %{REQUEST_URI} !^/cgi-bin/<br />
# Ư���� �۾�<br />
RewriteRule ^/(.*)$ /www/hosts/${lowercase:%{SERVER_NAME}}/docs/$1<br />
<br />
## ���� CGI�� ó���Ѵ� - MIME type�� �����ؾ� �Ѵ�<br />
RewriteCond %{REQUEST_URI} ^/cgi-bin/<br />
RewriteRule ^/(.*)$ /www/hosts/${lowercase:%{SERVER_NAME}}/cgi-bin/$1 [T=application/x-httpd-cgi]<br />
<br />
# ��!
</example>
</section>
<section id="homepages.rewrite"><title><code>mod_rewrite</code>��
����� Ȩ������ �ý���</title>
<p>������ <a href="#homepages">�� ��</a>�� ���� ����
�Ѵ�.</p>
<example>
RewriteEngine on<br />
<br />
RewriteMap lowercase int:tolower<br />
<br />
# CGI�� �����ϵ���<br />
RewriteCond %{REQUEST_URI} !^/cgi-bin/<br />
<br />
# RewriteRule�� �����ϵ��� ȣ��Ʈ���� �ùٸ��� �˻��Ѵ�<br />
RewriteCond ${lowercase:%{SERVER_NAME}} ^www\.[a-z-]+\.isp\.com$<br />
<br />
# ����ȣ��Ʈ���� URI �տ� ���δ�<br />
# [C]�� �� ��� ������ ���� ���ۼ��� �������� ���Ѵ�<br />
RewriteRule ^(.+) ${lowercase:%{SERVER_NAME}}$1 [C]<br />
<br />
# ���� ���� ���ϸ��� �����<br />
RewriteRule ^www\.([a-z-]+)\.isp\.com/(.*) /home/$1/$2<br />
<br />
# ��ü CGI ���丮�� �����Ѵ�<br />
ScriptAlias /cgi-bin/ /www/std-cgi/
</example>
</section>
<section id="xtra-conf"><title>������ ����ȣ��Ʈ ��������
����ϱ�</title>
<p>������ <code>mod_rewrite</code>�� ��� ����� ����Ͽ�
������ ���������� ������ ����ȣ��Ʈ�� ������Ʈ�� �˾Ƴ���.
�� ���������� �� ������ ������ �ʿ��ϴ�.</p>
<p><code>vhost.map</code> ������ ������ ����:</p>
<example>
www.customer-1.com /www/customers/1<br />
www.customer-2.com /www/customers/2<br />
# ...<br />
www.customer-N.com /www/customers/N<br />
</example>
<p><code>http.conf</code>�� ������ ����:</p>
<example>
RewriteEngine on<br />
<br />
RewriteMap lowercase int:tolower<br />
<br />
# ���������� �����Ѵ�<br />
RewriteMap vhost txt:/www/conf/vhost.map<br />
<br />
# ���� ���� alias���� ó���Ѵ�<br />
RewriteCond %{REQUEST_URI} !^/icons/<br />
RewriteCond %{REQUEST_URI} !^/cgi-bin/<br />
RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$<br />
# ���� ������ ������ ��<br />
RewriteCond ${vhost:%1} ^(/.*)$<br />
RewriteRule ^/(.*)$ %1/docs/$1<br />
<br />
RewriteCond %{REQUEST_URI} ^/cgi-bin/<br />
RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$<br />
RewriteCond ${vhost:%1} ^(/.*)$<br />
RewriteRule ^/(.*)$ %1/cgi-bin/$1
</example>
</section>
</manualpage>