<-
Apache > HTTP Server > Documentation > Version 2.4 > ����ȣ��Ʈ

�뷮�� ����ȣ��Ʈ�� �������� �����ϱ�

������ ���:  en  |  fr  |  ko  |  tr 

�� ������ �ֽ��� ������ �ƴմϴ�. �ֱٿ� ����� ������ ���� ������ �����ϼ���.

�� ������ ����ġ 1.3���� �뷮�� ����ȣ��Ʈ�� ȿ�������� �����ϴ� ����� �����Ѵ�.

Support Apache!

����

top

����

����� apache2.conf�� ������ ���� ���� ����� <VirtualHost> ���ǵ��� ���� �ִٸ� ���⼭ �����ϴ� ����� ������ �� ���̴�:

NameVirtualHost 111.22.33.44
<VirtualHost 111.22.33.44>
ServerName www.customer-1.com
DocumentRoot /www/hosts/www.customer-1.com/docs
ScriptAlias /cgi-bin/ /www/hosts/www.customer-1.com/cgi-bin
</VirtualHost>
<VirtualHost 111.22.33.44>
ServerName www.customer-2.com
DocumentRoot /www/hosts/www.customer-2.com/docs
ScriptAlias /cgi-bin/ /www/hosts/www.customer-2.com/cgi-bin
</VirtualHost>
# �ٺ� �ٺ� �ٺ�
<VirtualHost 111.22.33.44>
ServerName www.customer-N.com
DocumentRoot /www/hosts/www.customer-N.com/docs
ScriptAlias /cgi-bin/ /www/hosts/www.customer-N.com/cgi-bin
</VirtualHost>

�⺻ ������ ������ <VirtualHost> ���� ��θ� �������� ó���ϵ��� ��ü�ϴ� ���̴�. �׷��� ���� ������ �ִ�:

  1. ���������� �۾����� ����ġ�� ���� �����ϰ� �޸𸮸� ���� ����Ѵ�.
  2. ����ȣ��Ʈ�� �߰��ϱ����� ���Ͻý��ۿ� ������ ���丮�� ����� DNS�� �׸��� �߰��ϱ⸸ �ϸ�ȴ�. ��, ����ġ�� �缳���ϰ� ������� �ʿ䰡 ����.

������ �� ����ȣ��Ʈ���� �ٸ� �α������� ����� �� ���ٴ� ���̴�. �׷��� �ſ� ���� ����ȣ��Ʈ�� ����Ѵٸ� ���ϱ���ڸ� �� ������⶧���� ���� �ٸ� �α������� ����� �� ����. �������� fifo�� �α׸� ������, �޴� ������ �α׸� ó���Ͽ� ������ ����� (��� ���� ���� ���� �ִ�) �� ����.

top

����

����ȣ��Ʈ�� IP �ּҿ� HTTP ��û�� Host: ��� ������ �����Ѵ�. �⺻������ �뷮�� ���� ����ȣ��Ʈ ����� �ڵ����� ����ȣ��Ʈ ������ ��û�� ���ϰ�ο� �����Ѵ�. �̴� ��κ� mod_vhost_alias�� ����Ͽ� ���� �ذ��� �� ������, ����ġ 1.3.6 ���ϸ� ����Ѵٸ� mod_rewrite�� ����ؾ� �Ѵ�. �� �� ��� ��� �⺻������ ������ ���Ե��� �ʴ´�. �� ����� ����Ϸ��� ����ġ�� �����ϰ� �������Ҷ� �����ؾ� �Ѵ�.

���� ����ȣ��Ʈ�� �Ϲ����� ����ȣ��Ʈó�� ���̰��Ϸ��� ���������� `�ӿ���' �Ѵ�. ���� �߿��� ���� ����ġ�� �ڱ����� URL ���� ���鶧 ����� �������̴�. �������� ServerName ���þ�� �����ϸ�, CGI���� SERVER_NAME ȯ�溯���� �־�����. ������ ���� �������� UseCanonicalName ������ �޷ȴ�. UseCanonicalName Off�̸� ��û�� Host: ��� ������ �������� �ȴ�. UseCanonicalName DNS�̸� ����ȣ��Ʈ�� IP �ּҸ� ��DNS �˻��Ͽ� �������� �˾Ƴ���. ���ڴ� �̸���� ���� ����ȣ��Ʈ���� ����ϰ�, ���ڴ� IP��� ����ȣ��Ʈ���� ����Ѵ�. Host: ����� ���ų� DNS �˻��� �����Ͽ� ����ġ�� �������� �˾Ƴ��� ���ϸ� ServerName���� ������ ���� ��� ����Ѵ�.

�ٸ� `����' ���� (DocumentRoot�� �����ϸ�, CGI���� DOCUMENT_ROOT ȯ�溯���� �־�����) ������Ʈ�̴�. �Ϲ����� ��� core ����� �� ������ ����Ͽ� URI�� �ش��ϴ� ���ϸ��� ã����, ������ ���� ����ȣ������ �Ҷ��� �ٸ� ����� (mod_vhost_alias�� mod_rewrite) �ٸ� ������� �̷� �۾��� �Ѵ�. �� ��� ��� DOCUMENT_ROOT ȯ�溯���� ������� �����Ƿ� CGI�� SSI ������ �� ���� ����Ѵٸ� �߸��� ����� ���� �� �ִ�.

top

������ ���� ����ȣ��Ʈ

�� ���� ���� ����ȣ��Ʈ ������ mod_vhost_alias�� ����Ͽ� �� �Ϲ������� �����ߴ�.

# Host: ������� �������� �˾Ƴ���
UseCanonicalName Off

# ù��° �ʵ带 ����Ͽ� �� �α׸� ����ȣ��Ʈ���� ���� �� �ִ�
LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon
CustomLog logs/access_log vcommon

# ��û�� ó���ϱ����� ���ϸ��� �������� �����Ѵ�
VirtualDocumentRoot /www/hosts/%0/docs
VirtualScriptAlias /www/hosts/%0/cgi-bin

�� �������� UseCanonicalName Off�� UseCanonicalName DNS�� �����ϱ⸸ �ϸ� IP��� ����ȣ��Ʈ�� �ȴ�. ����ȣ��Ʈ�� IP �ּҸ� ������ ���ϸ��� �߰��� �������� �� �� �ִ�.

top

�������� ȣ��Ʈ�ϴ� Ȩ������ �ý���

ISP Ȩ������ ������ ���� ���� ������ �����ߴ�. ���� �� ������ ������ ����ϸ� www.user.isp.com�� ������ /home/user/�� �δ� ������ �������� �Ϻθ� ������ ���ϸ��� ���� �� �ִ�. �� ������ cgi-bin�� �� ����ȣ��Ʈ�� ���� �������ʰ� ��� ����ȣ��Ʈ�� ���� ����Ѵ�.

# �⺻���� ������ ���� ����. �׸���

# ���ϸ��� �������� �Ϻθ� �����Ѵ�
VirtualDocumentRoot /www/hosts/%2/docs

# �ϳ��� cgi-bin ���丮
ScriptAlias /cgi-bin/ /www/std-cgi/

mod_vhost_alias �������� �� ������ VirtualDocumentRoot ������ ���� �ִ�.

top

�� ������ ���� ����ȣ��Ʈ �ý��� ����ϱ�

�� ������ ������ ���� ����ġ�� �Ϲ����� <VirtualHost> ���þ ����Ͽ� ���� ����ȣ��Ʈ ������ ������ ������ �� �ִ�. ���� ���, ������ ���� ������ Ȩ������ ������ IP �ּ� �Ѱ�, ������� �������� �ٸ� IP �ּ� �Ѱ��� �ο��Ѵ�. ���� ����ó�� <VirtualHost> ���� ���ǿ� ��� ���� ���� �ִ�.

UseCanonicalName Off

LogFormat "%V %h %l %u %t \"%r\" %s %b" vcommon

<Directory /www/commercial>
Options FollowSymLinks
AllowOverride All
</Directory>

<Directory /www/homepages>
Options FollowSymLinks
AllowOverride None
</Directory>

<VirtualHost 111.22.33.44>
ServerName www.commercial.isp.com

CustomLog logs/access_log.commercial vcommon

VirtualDocumentRoot /www/commercial/%0/docs
VirtualScriptAlias /www/commercial/%0/cgi-bin
</VirtualHost>

<VirtualHost 111.22.33.45>
ServerName www.homepages.isp.com

CustomLog logs/access_log.homepages vcommon

VirtualDocumentRoot /www/homepages/%0/docs
ScriptAlias /cgi-bin/ /www/std-cgi/
</VirtualHost>

top

�� ȿ������ IP��� ����ȣ��Ʈ

ù��° ������ ���� ������ ������ IP��� ����ȣ��Ʈ�� �ٲ� �� �ִٰ� ���ߴ�. �������� �׷� ������ �� ��û���� DNS�� ã�ƾ��ϹǷ� �ſ� ��ȿ�����̴�. �̸���� IP �ּҷ� ���Ͻý����� �����ϰ� ���� ������� �α׸� �����ϸ� ������ �ذ��� �� �ִ�. ����ġ�� �������� �ٷ� �ʿ䰡 ��������, DNS �˻��� ���� �ʰ� �ȴ�.

# IP �ּҸ� ��DNS �˻��Ͽ� �������� �˾Ƴ���
UseCanonicalName DNS

# �α׸� ���� �� �ֵ��� IP �ּҸ� �����Ѵ�
LogFormat "%A %h %l %u %t \"%r\" %s %b" vcommon
CustomLog logs/access_log vcommon

# ���ϸ��� IP �ּҸ� �����Ѵ�
VirtualDocumentRootIP /www/hosts/%0/docs
VirtualScriptAliasIP /www/hosts/%0/cgi-bin

top

����ġ ���� ���� ����ϱ�

�� ������ ����ġ ���� 1.3.6 ���Ŀ� ���Ե� mod_vhost_alias�� ����Ѵ�. mod_vhost_alias�� ���� ����ġ ������ ����Ѵٸ� �̹� ���ߵ��� mod_rewrite�� ����Ͽ�, �� Host:-������ ����ȣ��Ʈ����, ������ �� �ִ�.

�� �α׿� ���Ͽ� ������ ���� �ִ�. ����ġ 1.3.6���� �α����� ���þ� %V�� ���ԵǾ���, ���� 1.3.0 - 1.3.3���� �� ����� %v �ɼ��� ��� �ߴ�. �׷��� ���� 1.3.4���� �̷� ����� ����. � ����ġ ���������� .htaccess ���Ͽ��� UseCanonicalName ���þ ����� �� �����Ƿ� �α׿� �̻��� ������ ��ϵ� �� �ִ�. �׷��Ƿ� ���� ���� ����� %{Host}i ���þ ����Ͽ� Host: ����� ���� �α׿� ����� ���̴�. ��, �� ����� %V�� ���������ʴ� :port�� �ڿ� �߰��� �� �ִ�.

top

mod_rewrite�� ����� ������ ���� ����ȣ��Ʈ

������ ù��° ���� ���� ���� �ϴ� apache2.conf ���̴�. ó�� ������ ù��° ���� ���� ���������, ���� �������� ȣȯ���� mod_rewrite�� ������ ������ ���� �����Ǿ���. ������ ������ ���� �۾��� �ϴ� mod_rewrite�� �����Ѵ�.

Ư���� �����ؾ� �� ������ �ִ�. �⺻������ mod_rewrite�� (mod_alias ��) �ٸ� URI ���� ��� ������ ����ȴ�. �׷��� �ٸ� URI ���� ����� ���� ������ ���� �����Ͽ� mod_rewrite�� �����ؾ� �Ѵ�. ��, ���� ����ȣ��Ʈ���� ScriptAlias�� ���� ����� ���ؼ��� Ư���� �۾��� �ʿ��ϴ�.

# Host: ������� �������� ��´�
UseCanonicalName Off

# splittable logs
LogFormat "%{Host}i %h %l %u %t \"%r\" %s %b" vcommon
CustomLog logs/access_log vcommon

<Directory /www/hosts>
# ScriptAlias ������ CGI ������ ������ �� ���⶧����
# ���⿡ ExecCGI�� ����Ѵ�
Options FollowSymLinks ExecCGI
</Directory>

# ���� ����� �κ��̴�

RewriteEngine On

# Host: ������� ������ ���������� ��ҹ��ڰ� �ڼ������� �� �ִ�
RewriteMap lowercase int:tolower

## �Ϲ� ������ ���� ó���Ѵ�:
# Alias /icons/ �� �����ϵ��� - �ٸ� alias�� ���ؼ��� �ݺ�
RewriteCond %{REQUEST_URI} !^/icons/
# CGI�� �����ϵ���
RewriteCond %{REQUEST_URI} !^/cgi-bin/
# Ư���� �۾�
RewriteRule ^/(.*)$ /www/hosts/${lowercase:%{SERVER_NAME}}/docs/$1

## ���� CGI�� ó���Ѵ� - MIME type�� �����ؾ� �Ѵ�
RewriteCond %{REQUEST_URI} ^/cgi-bin/
RewriteRule ^/(.*)$ /www/hosts/${lowercase:%{SERVER_NAME}}/cgi-bin/$1 [T=application/x-httpd-cgi]

# ��!

top

mod_rewrite�� ����� Ȩ������ �ý���

������ �ι�° ���� ���� ���� �Ѵ�.

RewriteEngine on

RewriteMap lowercase int:tolower

# CGI�� �����ϵ���
RewriteCond %{REQUEST_URI} !^/cgi-bin/

# RewriteRule�� �����ϵ��� ȣ��Ʈ���� �ùٸ��� �˻��Ѵ�
RewriteCond ${lowercase:%{SERVER_NAME}} ^www\.[a-z-]+\.isp\.com$

# ����ȣ��Ʈ���� URI �տ� ���δ�
# [C]�� �� ����� ������ ���� ���ۼ��� �������� ���Ѵ�
RewriteRule ^(.+) ${lowercase:%{SERVER_NAME}}$1 [C]

# ���� ���� ���ϸ��� �����
RewriteRule ^www\.([a-z-]+)\.isp\.com/(.*) /home/$1/$2

# ��ü CGI ���丮�� �����Ѵ�
ScriptAlias /cgi-bin/ /www/std-cgi/

top

������ ����ȣ��Ʈ �������� ����ϱ�

������ mod_rewrite�� ���� ����� ����Ͽ� ������ ���������� ������ ����ȣ��Ʈ�� ������Ʈ�� �˾Ƴ���. �� ���������� �� ������ ������ �ʿ��ϴ�.

vhost.map ������ ������ ����:

www.customer-1.com /www/customers/1
www.customer-2.com /www/customers/2
# ...
www.customer-N.com /www/customers/N

http.conf�� ������ ����:

RewriteEngine on

RewriteMap lowercase int:tolower

# ���������� �����Ѵ�
RewriteMap vhost txt:/www/conf/vhost.map

# ���� ���� alias���� ó���Ѵ�
RewriteCond %{REQUEST_URI} !^/icons/
RewriteCond %{REQUEST_URI} !^/cgi-bin/
RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
# ���� ������ ������ ��
RewriteCond ${vhost:%1} ^(/.*)$
RewriteRule ^/(.*)$ %1/docs/$1

RewriteCond %{REQUEST_URI} ^/cgi-bin/
RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
RewriteCond ${vhost:%1} ^(/.*)$
RewriteRule ^/(.*)$ %1/cgi-bin/$1

������ ���:  en  |  fr  |  ko  |  tr 

top

Comments

Notice:
This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our mailing lists.