summaryrefslogtreecommitdiff
path: root/docs/manual/mod/mod_access.html
blob: b562853fbcbe6c5bdef1eeca47352305eaf8d67a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML>
<HEAD>
<TITLE>Apache module mod_access</TITLE>
</HEAD>

<BODY>
<!--#include virtual="header.html" -->

<H1>Module mod_access</h1>

This module is contained in the <code>mod_access.c</code> file, and
is compiled in by default. It provides access control based on client
hostname or IP address.


<menu>
<li><A HREF="#allow">allow</A>
<li><A HREF="#allowfromenv">allow from env=</A>
<li><A HREF="#deny">deny</A>
<li><A HREF="#denyfromenv">deny from env=</A>
<li><A HREF="#order">order</A>
</menu>
<hr>


<A name="allow"><h2>allow</h2></A>
<!--%plaintext &lt;?INDEX {\tt allow} directive&gt; -->
<strong>Syntax:</strong> allow from <em>host host ...</em><br>
<Strong>Context:</strong> directory, .htaccess<br>
<Strong>Override:</strong> Limit<br>
<strong>Status:</strong> Base<br>
<strong>Module:</strong> mod_access<p>

The allow directive affects which hosts can access a given directory.
<em>Host</em> is one of the following:
<dl>
<dt><code>all</code>
<dd>all hosts are allowed access
<dt>A (partial) domain-name
<dd>host whose name is, or ends in, this string are allowed access.
<dt>A full IP address
<dd>An IP address of a host allowed access
<dt>A partial IP address
<dd>The first 1 to 3 bytes of an IP address, for subnet restriction.
</dl>

Example:<blockquote><code>allow from .ncsa.uiuc.edu</code></blockquote>
All hosts in the specified domain are allowed access.<p>

Note that this compares whole components; <code>bar.edu</code>
would not match <code>foobar.edu</code>.<p>

See also <A HREF="#deny">deny</A>, <A HREF="#order">order</A>, and
<a href="mod_browser.html#browsermatch">BrowserMatch</a>.<p>

<a name="allowfromenv"><strong>Syntax:</strong> allow from env=<em>variablename</em></a><br>
<Strong>Context:</strong> directory, .htaccess<br>
<Strong>Override:</strong> Limit<br>
<strong>Status:</strong> Base<br>
<strong>Module:</strong> mod_access<br>
<strong>Compatibility:</strong> Apache 1.2 and above<p>

The allow from env directive controls access to a directory by the
existence (or non-existence) of an environment variable.

Example:<blockquote><pre>
BrowserMatch ^KnockKnock/2.0 let_me_in
&lt;Directory /docroot&gt;
order allow,deny
allow from env=let_me_in
deny from all
&lt;/Directory&gt;
</pre></blockquote>

See also <A HREF="#denyfromenv">deny from env</A>
and <A HREF="#order">order</A>.<p><hr>

<A name="deny"><h2>deny</h2></A>
<!--%plaintext &lt;?INDEX {\tt deny} directive&gt; -->
<strong>Syntax:</strong> deny from <em>host host ...</em><br>
<Strong>Context:</strong> directory, .htaccess<br>
<Strong>Override:</strong> Limit<br>
<strong>Status:</strong> Base<br>
<strong>Module:</strong> mod_access<p>

The deny directive affects which hosts can access a given directory.
<em>Host</em> is one of the following:
<dl>
<dt><code>all</code>
<dd>all hosts are denied access
<dt>A (partial) domain-name
<dd>host whose name is, or ends in, this string are denied access.
<dt>A full IP address
<dd>An IP address of a host denied access
<dt>A partial IP address
<dd>The first 1 to 3 bytes of an IP address, for subnet restriction.
</dl>

Example:<blockquote><code>deny from 16</code></blockquote>
All hosts in the specified network are denied access.<p>

Note that this compares whole components; <code>bar.edu</code>
would not match <code>foobar.edu</code>.<p>

See also <A HREF="#allow">allow</A> and <A HREF="#order">order</A>.<p>

<a name="denyfromenv"><strong>Syntax:</strong> deny from env=<em>variablename</em></a><br>
<Strong>Context:</strong> directory, .htaccess<br>
<Strong>Override:</strong> Limit<br>
<strong>Status:</strong> Base<br>
<strong>Module:</strong> mod_access<br>
<strong>Compatibility:</strong> Apache 1.2 and above<p>

The deny from env directive controls access to a directory by the
existence (or non-existence) of an environment variable.

Example:<blockquote><pre>
BrowserMatch ^BadRobot/0.9 go_away
&lt;Directory /docroot&gt;
order deny,allow
deny from env=go_away
allow from all
&lt;/Directory&gt;
</pre></blockquote>

See also <A HREF="#allowfromenv">allow from env</A>
and <A HREF="#order">order</A>.<p><hr>

<A name="order"><h2>order</h2></A>
<!--%plaintext &lt;?INDEX {\tt order} directive&gt; -->
<strong>Syntax:</strong> order <em>ordering</em><br>
<strong>Default:</strong> <code>order deny,allow</code><br>
<strong>Context:</strong> directory, .htaccess<br>
<strong>Override:</strong> Limit<br>
<strong>Status:</strong> Base<br>
<strong>Module:</strong> mod_access<p>

The order directive controls the order in which <A HREF="#allow">allow</A> and
<A HREF="#deny">deny</A> directives are evaluated. <em>Ordering</em> is one
of
<dl>
<dt>deny,allow
<dd>the deny directives are evaluated before the allow directives.  (The
initial state is OK.)
<dt>allow,deny
<dd>the allow directives are evaluated before the deny directives.  (The
initial state is FORBIDDEN.)
<dt>mutual-failure
<dd>Only those hosts which appear on the allow list and do not appear
on the deny list are granted access.  (The initial state is irrelevant.)
</dl>

Note that in all cases every <code>allow</code> and <code>deny</code>
statement is evaluated, there is no &quot;short-circuiting&quot;.

<p>Example:
<blockquote><code>
order deny,allow<br>
deny from all<br>
allow from .ncsa.uiuc.edu<br>
</code></blockquote>
Hosts in the ncsa.uiuc.edu domain are allowed access; all other hosts are
denied access.

<!--#include virtual="footer.html" -->
</BODY>
</HTML>