PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` - Apache HTTP Server Version 2.4
<-
Apache > HTTP Server > Documentation > Version 2.4

ֽ ƴմϴ. ֱٿ ϼ.

ִ þ ü ǰų, Ư 丮, , ȣƮ, 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 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 Libera.chat, or sent to our mailing lists.