<-
Apache > HTTP Server > Documentation > Version 2.4

���� ����

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

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

���������� �ִ� ���þ�� ���� ��ü�� ����ǰų�, Ư�� ���丮, ����, ȣ��Ʈ, URL���� ����� �� �ִ�. �� ������ �ٸ� ���þ��� ��������� �����ϱ����� ���� �����̳� .htaccess ������ ����ϴ� ����� �����Ѵ�.

Support Apache!

����

top

���� ������ ����

���ǿ��� �ΰ��� ������ �ִ�. ��κ��� �ſ�û���� ó���ȴ�. �ش��ϴ� ��û���� �ȿ� ������ ���þ �����Ѵ�. �ݴ��, <IfDefine>�� <IfModule>�� ������ �����Ҷ��� �������� ó���Ѵ�. �����Ҷ� ���°� ���̸� �ȿ� �ִ� ���þ ��� ��û�� ����ȴ�. ���� �ƴϸ� �ȿ� �ִ� ���þ�� �����Ѵ�.

<IfDefine> ���þ�� httpd �����࿡ ������ �Ķ���Ͱ� �ִ� ��쿡�� �ȿ� ������ ���þ �����Ѵ�. ���� ������ ���� ���, ������ httpd -DClosedForNow�� ������ ��쿡�� ��� ��û�� �ٸ� ����Ʈ�� �����̷��ǵȴ�:

<IfDefine ClosedForNow>
Redirect / http://otherserver.example.com/
</IfDefine>

<IfModule> ���þ Ư�� ����� ������ ���Ե� ��쿡�� �ȿ� �� ���þ �����Ѵٴ� ���� �����ϰ��� �ſ� ����ϴ�. ����� ������ �������� �������ϰų� �������� ���������� �������� �տ� LoadModule ���� �־�� �Ѵ�. �� ���þ�� Ư�� ����� ��ġ������ ���� ���������� �ٸ� �ʿ䰡 �������� ����ؾ� �Ѵ�. ����� ���� ��� ������ �������� ���������� �� �ֱ� ������ ������ ����ϱ� ���ϴ� ���þ �ȿ� �θ� �ȵȴ�.

���� ������ mod_mime_magic�� �������� MimeMagicFiles ���þ ó���Ѵ�.

<IfModule mod_mime_magic.c>
MimeMagicFile conf/magic
</IfModule>

<IfDefine>�� <IfModule>�� �˻� �տ� "!"�� �ٿ� ������ ������ �� �� �ִ�. ��, ���� ���ǵ��� ���ļ� ����Ͽ� �� ������ ȿ���� ���� �� �ִ�.

top

���Ͻý��۰� ������

���� ���� ���Ǵ� ���� ������ ���Ͻý��۰� ������(webspace)�� Ư�� ��ҿ� ���� ������ �����ϴ� �͵��̴�. ���� �� ���� ���̸� �����ϴ� ���� �߿��ϴ�. ���Ͻý����� �ü�� ���忡�� ��ũ�� ���� �����̴�. ���� ���, �⺻������ ����ġ�� ��ġ�� �ϸ� ���н� ���Ͻý����� ��� /usr/local/apache2, �������� ���Ͻý����� ��� "c:/Program Files/Apache Group/Apache2"�� ��ġ�ȴ�. (����ġ�� ��������� ���� �׻�, ���������� �ƴ�, �������� ������� �����϶�.) �ݴ�� �������� �������� �����ϰ� Ŭ���̾�Ʈ�� ���Ե� ����Ʈ�� �����̴�. �׷��� ���н����� �⺻ ����ġ ��ġ�� �� ��� ������� ��� /dir/�� ���Ͻý��� ��� /usr/local/apache2/htdocs/dir/�� �ش��Ѵ�. �������� ����Ÿ���̽� ��� �������� ������ �� �ֱ⶧���� �ݵ�� ���Ͻý��ۿ� ���� ������ �ʿ�� ����.

���Ͻý��� ����

<Directory>�� <Files> ���þ�� ����ǥ������ ����ϴ� ���þ�� ���Ͻý����� Ư�� �κп� ���þ �����Ѵ�. <Directory> ���þ ���Ե� ���þ���� ������ ���Ͻý��� ���丮�� �� ���� ���丮�� ����ȴ�. .htaccess ������ ����ص� ����� ����. ���� ������ ���� ���, ���丮 ���(index)�� /var/web/dir1 ���� ���丮���� ���丮 ���(index)�� �����ϴ�.

<Directory /var/web/dir1>
Options +Indexes
</Directory>

<Files> ���ǿ� ���Ե� ���þ���� � ���丮�� �ִ��� ������� ������ �̸��� ���� ���Ͽ� ����ȴ�. ���������� �ּ����κп� �ִ� ���� ������ ���� ���, ��ҿ� ������� private.html�̶� �̸��� �� ������ ������ �ź��Ѵ�.

<Files private.html>
Order allow,deny
Deny from all
</Files>

���Ͻý����� Ư�� �κп� �ִ� ������ ��Ī�ϱ����� <Files>�� <Directory> ������ ���� ����Ѵ�. ���� ������ ���� ���, /var/web/dir1/private.html, /var/web/dir1/subdir2/private.html, /var/web/dir1/subdir3/private.html ���� /var/web/dir1/ ���丮 �Ʒ��� �ִ� �̸��� private.html�� ������ ������ �ź��Ѵ�.

<Directory /var/web/dir1>
<Files private.html>
Order allow,deny
Deny from all
</Files>
</Directory>

������ ����

<Location> ���þ�� �̿� �ش��ϴ� ����ǥ������ ����ϴ� ���þ�� �ݴ�� Ư�� �������� ������ �ٲ۴�. ���� ������ ���� ���, /private���� �����ϴ� URL-����� ������ �źεȴ�. ���⿡�� http://yoursite.example.com/private, http://yoursite.example.com/private123, http://yoursite.example.com/private/dir/file.html ���� /private ���ڿ��� �����ϴ� ��û�� �ش�ȴ�.

<Location /private>
Order Allow,Deny
Deny from all
</Location>

<Location> ���þ�� ���Ͻý��ۿ� ������ �ʿ䰡 ����. ���� ���� ��� Ư�� URL�� mod_status�� �����ϴ� ����ġ ���� �ڵ鷯�� ������Ű������ �����ش�. ���Ͻý��ۿ� server-status��� ������ �ʿ����.

<Location /server-status>
SetHandler server-status
</Location>

���ϵ�ī��� ����ǥ����

<Directory>, <Files>, <Location> ���þ�� C ǥ�� ���̺귯���� fnmatch�� ���� ������ ����ϴ� ���ϵ�ī�� ���ڸ� ����� �� �ִ�. "*" ���ڴ� � ���ڿ��̶� ��Ÿ����, "?" ���ڴ� � ���� �Ѱ��� ��Ÿ����, "[seq]"�� seq �߿� �� ���ڸ� ��Ÿ����. � ���ϵ�ī�嵵 "/" ���ڸ� ��Ÿ������ ���Ѵ�. �׷��� �� ���ڴ� ���� ����ؾ� �Ѵ�.

�� ������ ������ �ʿ��ϸ� perlȣȯ ����ǥ������ ����ϴ� <DirectoryMatch>, <FilesMatch>, <LocationMatch>�� ����� �� �ִ�. �׷��� �Ʒ� ������ ���տ� ���� ������ ����ǥ���� ������ ����ϸ� ���þ ����Ǵ� ����� ��� ���ϴ��� �������.

��� ����� ���丮 ������ �����ϴ� ������ǥ���� ���ϵ�ī�� ������ ������ ����:

<Directory /home/*/public_html>
Options Indexes
</Directory>

����ǥ���� ������ ����Ͽ� �ѹ��� ���� ������ �׸����Ͽ� ���� ������ �ź��� �� �ִ�:

<FilesMatch \.(?i:gif|jpe?g|png)$>
Order allow,deny
Deny from all
</FilesMatch>

������ ����ϳ�

���Ͻý��� ���ǰ� ������ ���� �� �ϳ��� �����ϴ� ���� ������ �ſ� ����. ���Ͻý��ۿ� �ִ� ��ü�� ���þ �����Ҷ��� �׻� <Directory>�� <Files>�� ����Ѵ�. (����Ÿ���̽����� ������ ���������� ����) ���Ͻý��ۿ� ���� �ʴ� ��ü�� ���þ �����Ҷ��� <Location>�� ����Ѵ�.

���Ͻý��ۿ� �ִ� ��ü�� ������ �����ϱ����� <Location>�� ����ϸ� ���� �ȵȴ�. ���� �ٸ� ������ ���(URL)�� ���� ���Ͻý��� ��ҿ� ������ �� �����Ƿ�, �ɾ�� ������ ��ȸ�� �� �ֱ� �����̴�. ���� ������ ���� ���캸��:

<Location /dir/>
Order allow,deny
Deny from all
</Location>

�� ������ http://yoursite.example.com/dir/�� ��û�Ѵٸ� �� �۵��Ѵ�. �׷��� ��ҹ��ڸ� ���������ʴ� ���Ͻý����� ����Ѵٸ� ��Եdz�? http://yoursite.example.com/DIR/�� ��û�Ͽ� ���� ������ ��ȸ�� �� �ִ�. �ݴ�� <Directory> ���þ�� ��� ��û�Ͽ����� ������� �� ��ҿ��� ���񽺵Ǵ� ���뿡 ����ȴ�. (���ܴ� ���Ͻý��� ��ũ�� ����ϴ� ����. �ɺ���ũ�� ����Ͽ� �� ���丮�� ���Ͻý����� ���� ��ҿ� �� �� �ִ�. <Directory> ���þ�� �ɺ���ũ�� ���󰣴�. �׷��Ƿ� ���� ������ ������ ���ؼ��� ������ Options ���þ ����Ͽ� �ɺ���ũ�� �����ؾ� �Ѵ�.)

�Ƹ��� ����� ��ҹ��ڸ� �����ϴ� ���Ͻý����� ����ϹǷ� �̷� ���� �Ͼ�� �ʴ´ٰ� ���������� �𸥴�. �׷��� �ٸ� ������ε� ���� ������ ��ġ�� �� ���Ͻý��� ��ġ�� ������ �� ������ ����϶�. �׷��� �����ϸ� �׻� ���Ͻý��� ������ ����ؾ� �Ѵ�. �׷��� �� ��Ģ�� ���ܰ� �ϳ� �ִ�. ���� ������ <Location /> ���ǿ� �θ� �� ������ Ư�� URL�� �ƴ� ��� ��û�� ����ǹǷ� �Ϻ��ϰ� �����ϴ�.

top

����ȣ��Ʈ

<VirtualHost> ������ Ư�� ȣ��Ʈ�� ����Ǵ� ���þ���� �����Ѵ�. �̴� �� ��ǻ�Ϳ��� ���� �ٸ� ������ ����� ���� ȣ��Ʈ�� �����Ҷ� �����ϴ�. �� �ڼ��� ������ ����ȣ��Ʈ ������ �����϶�.

top

���Ͻ�

<Proxy>�� <ProxyMatch> ������ ������ URL�� ���� mod_proxy ���Ͻ� ������ ���� �����ϴ� ��쿡�� ����ȴ�. ���� ������ ���� ���, ���Ͻ� ������ ���� cnn.com ������Ʈ�� ������ �� ����.

<Proxy http://cnn.com/*>
Order allow,deny
Deny from all
</Proxy>

top

�ȿ� � ���þ ����� �� �ֳ�?

� ���� ���Ǿȿ� ����� �� �ִ� ���þ �˷��� ���þ��� �������� Ȯ���϶�. <Directory>���� ��밡���� ���þ�� <DirectoryMatch>, <Files>, <FilesMatch>, <Location>, <LocationMatch>, <Proxy>, <ProxyMatch> ���ǿ����� ��밡���ϴ�. �׷���, ���ܰ� �ִ�:

top

���ǵ��� �����ϴ� ���

���� ������ �ſ� Ư���� ������� ����ȴ�. �� ������ ���� ���þ �ؼ��ϴ� ����� �߿��� ������ �ֱ⶧���� �� ����� �����ϴ� ���� �߿��ϴ�.

�����ϴ� ������:

  1. (����ǥ������ ��������ʴ�) <Directory>�� .htaccess�� ���ÿ� �Ͼ�� (��쿡 ���� .htaccess�� <Directory>�� �����ϵ��� ������ �� �ִ�)
  2. <DirectoryMatch> (�׸��� <Directory ~>)
  3. <Files>�� <FilesMatch>�� ���ÿ� �Ͼ��
  4. <Location>�� <LocationMatch>�� ���ÿ� �Ͼ��

<Directory>�� �����ϰ� �� ���ǵ��� �������Ͽ� ���� ������� ó���ȴ�. (���� ���� 1) <Directory>�� ���丮 ������ ���� ª�� �Ϳ��� �������� ó���ȴ�. �׷��� ���� ���, <Directory /var/web/dir>�� <Directory /var/web/dir/subdir> ������ ó���Ѵ�. ���� ���丮�� ��Ī�ϴ� ���� <Directory> ������ �ִٸ� �̵��� �������� ������� ó���Ѵ�. Include ���þ�� ������ ������ Include ���þ� ��ġ�� ������ ���� ������ �ִ� ��ó�� ó���Ѵ�.

<VirtualHost> ���� �ȿ� ���Ե� ������ ����ȣ��Ʈ ���� �ۿ� �ִ� �ش� ���� ���Ŀ� ����ȴ�. �׷��� ����ȣ��Ʈ �ȿ��� �ּ����� ���������� ������ �� �ִ�.

mod_proxy�� ��û �����Ҷ�, <Proxy> ������ ó�������� <Directory> ���ǰ� ����.

������ ������ ������ ���� ������ ����� �����Ѵ�.

����� ����

������ <Location>/<LocationMatch>�� (Aliases�� DocumentRoot�� ����Ͽ� URL�� ���ϸ����� ��ȯ�ϴ�) �̸����� �ܰ� ������ ó���ȴ�. ������ ���� ���Ŀ��� ������ �����Ѵ�.

����

������ �����ϴ� ������ �����ϴ� ����. �̵� ��� ��û�� ����ȴٰ� �����ϸ� ���þ�� A > B > C > D > E ������ ó���ȴ�.

<Location />
E
</Location>

<Files f.html>
D
</Files>

<VirtualHost *>
<Directory /a/b>
B
</Directory>
</VirtualHost>

<DirectoryMatch "^.*b$">
C
</DirectoryMatch>

<Directory /a/b>
A
</Directory>

�� �������� ���� ������ ����. <Location> ������ ���߿� ó���ϹǷ� <Directory> ���ǿ� �ִ� �������Ѱ� ������� ������ ������ ������ �����ϴ�. ��, �����ϴ� ������ �߿��ϹǷ� �����϶�!

<Location />
Order deny,allow
Allow from all
</Location>

# ��! �� <Directory> ������ �ƹ��� ȿ���� ����
<Directory />
Order allow,deny
Allow from all
Deny from badguy.example.com
</Directory>

������ ���:  en  |  fr  |  ja  |  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.