@@ -50,15 +50,20 @@ within that directory can be used. To do this the Directory directive must
50
50
be used::
51
51
52
52
<Directory /usr/local/wsgi/scripts>
53
- Order allow,deny
54
- Allow from all
53
+ <IfVersion < 2.4>
54
+ Order allow,deny
55
+ Allow from all
56
+ </IfVersion>
57
+ <IfVersion >= 2.4>
58
+ Require all granted
59
+ </IfVersion>
55
60
</Directory>
56
61
57
- Note that Apache access control directives such as Order and Allow should
58
- nearly always be applied to Directory and never to a Location. Adding them
59
- to a Location would not be regarded as best practice and would potentially
60
- weaken the security of your Apache server, especially where the Location
61
- was for '/'.
62
+ Note that Apache access control directives such as Order and Allow, or
63
+ Require in the case of Apache 2.4 or newer, should nearly always be applied
64
+ to Directory and never to a Location. Adding them to a Location would not
65
+ be regarded as best practice and would potentially weaken the security of
66
+ your Apache server, especially where the Location was for '/'.
62
67
63
68
As for CGI scripts and the ScriptAlias directive, it is not necessary to
64
69
have used the Options directive to enable the ExecCGI directive. This is
@@ -117,8 +122,13 @@ specific URLs. The equivalent such configuration for::
117
122
WSGIScriptAlias /wsgi/ /usr/local/wsgi/scripts/
118
123
119
124
<Directory /usr/local/wsgi/scripts>
120
- Order allow,deny
121
- Allow from all
125
+ <IfVersion < 2.4>
126
+ Order allow,deny
127
+ Allow from all
128
+ </IfVersion>
129
+ <IfVersion >= 2.4>
130
+ Require all granted
131
+ </IfVersion>
122
132
</Directory>
123
133
124
134
using the Alias directive would be::
@@ -130,8 +140,13 @@ using the Alias directive would be::
130
140
131
141
SetHandler wsgi-script
132
142
133
- Order allow,deny
134
- Allow from all
143
+ <IfVersion < 2.4>
144
+ Order allow,deny
145
+ Allow from all
146
+ </IfVersion>
147
+ <IfVersion >= 2.4>
148
+ Require all granted
149
+ </IfVersion>
135
150
</Directory>
136
151
137
152
The additional steps required in this case are to enable the ability to
@@ -151,8 +166,13 @@ resource types based on resource extension::
151
166
AddHandler cgi-script .cgi
152
167
AddHandler wsgi-script .wsgi
153
168
154
- Order allow,deny
155
- Allow from all
169
+ <IfVersion < 2.4>
170
+ Order allow,deny
171
+ Allow from all
172
+ </IfVersion>
173
+ <IfVersion >= 2.4>
174
+ Require all granted
175
+ </IfVersion>
156
176
</Directory>
157
177
158
178
For whatever extension you use to identify a WSGI script file, ensure that
@@ -177,8 +197,13 @@ option and MultiviewsMatch directive::
177
197
AddHandler cgi-script .cgi
178
198
AddHandler wsgi-script .wsgi
179
199
180
- Order allow,deny
181
- Allow from all
200
+ <IfVersion < 2.4>
201
+ Order allow,deny
202
+ Allow from all
203
+ </IfVersion>
204
+ <IfVersion >= 2.4>
205
+ Require all granted
206
+ </IfVersion>
182
207
</Directory>
183
208
184
209
Adding of MultiViews in this instance and allowing multiviews to match
@@ -201,8 +226,13 @@ the directory. To enable directory browsing add the Indexes option::
201
226
AddHandler cgi-script .cgi
202
227
AddHandler wsgi-script .wsgi
203
228
204
- Order allow,deny
205
- Allow from all
229
+ <IfVersion < 2.4>
230
+ Order allow,deny
231
+ Allow from all
232
+ </IfVersion>
233
+ <IfVersion >= 2.4>
234
+ Require all granted
235
+ </IfVersion>
206
236
</Directory>
207
237
208
238
If a directory index page is enabled, it may refer to either a static file,
@@ -219,8 +249,13 @@ designate what should be used for the index page::
219
249
AddHandler cgi-script .cgi
220
250
AddHandler wsgi-script .wsgi
221
251
222
- Order allow,deny
223
- Allow from all
252
+ <IfVersion < 2.4>
253
+ Order allow,deny
254
+ Allow from all
255
+ </IfVersion>
256
+ <IfVersion >= 2.4>
257
+ Require all granted
258
+ </IfVersion>
224
259
</Directory>
225
260
226
261
Using AddHandler or SetHandler to configure a WSGI application can also
@@ -238,8 +273,13 @@ Options directive by listing ExecCGI::
238
273
Options ExecCGI MultiViews Indexes
239
274
MultiviewsMatch Handlers
240
275
241
- Order allow,deny
242
- Allow from all
276
+ <IfVersion < 2.4>
277
+ Order allow,deny
278
+ Allow from all
279
+ </IfVersion>
280
+ <IfVersion >= 2.4>
281
+ Require all granted
282
+ </IfVersion>
243
283
</Directory>
244
284
245
285
This done, the '.htaccess' file could then contain::
@@ -388,15 +428,25 @@ which should be served in this way::
388
428
Alias /media/ /usr/local/wsgi/static/media/
389
429
390
430
<Directory /usr/local/wsgi/static>
391
- Order deny,allow
392
- Allow from all
431
+ <IfVersion < 2.4>
432
+ Order allow,deny
433
+ Allow from all
434
+ </IfVersion>
435
+ <IfVersion >= 2.4>
436
+ Require all granted
437
+ </IfVersion>
393
438
</Directory>
394
439
395
440
WSGIScriptAlias / /usr/local/wsgi/scripts/myapp.wsgi
396
441
397
442
<Directory /usr/local/wsgi/scripts>
398
- Order allow,deny
399
- Allow from all
443
+ <IfVersion < 2.4>
444
+ Order allow,deny
445
+ Allow from all
446
+ </IfVersion>
447
+ <IfVersion >= 2.4>
448
+ Require all granted
449
+ </IfVersion>
400
450
</Directory>
401
451
402
452
When listing the directives, list those for more specific URLs first. In
@@ -465,8 +515,13 @@ the WSGIApplicationGroup directive::
465
515
<Directory /usr/local/wsgi/scripts>
466
516
WSGIApplicationGroup admin-scripts
467
517
468
- Order allow,deny
469
- Allow from all
518
+ <IfVersion < 2.4>
519
+ Order allow,deny
520
+ Allow from all
521
+ </IfVersion>
522
+ <IfVersion >= 2.4>
523
+ Require all granted
524
+ </IfVersion>
470
525
</Directory>
471
526
472
527
The argument to the WSGIApplicationGroup directive can in general be any
@@ -560,17 +615,27 @@ specific WSGI applications to execute within that daemon process::
560
615
Alias /media/ /usr/local/wsgi/static/media/
561
616
562
617
<Directory /usr/local/wsgi/static>
563
- Order deny,allow
564
- Allow from all
618
+ <IfVersion < 2.4>
619
+ Order allow,deny
620
+ Allow from all
621
+ </IfVersion>
622
+ <IfVersion >= 2.4>
623
+ Require all granted
624
+ </IfVersion>
565
625
</Directory>
566
626
567
627
WSGIScriptAlias / /usr/local/wsgi/scripts/myapp.wsgi
568
628
WSGIProcessGroup www.site.com
569
629
570
630
<Directory /usr/local/wsgi/scripts>
571
631
572
- Order allow,deny
573
- Allow from all
632
+ <IfVersion < 2.4>
633
+ Order allow,deny
634
+ Allow from all
635
+ </IfVersion>
636
+ <IfVersion >= 2.4>
637
+ Require all granted
638
+ </IfVersion>
574
639
</Directory>
575
640
576
641
Where Apache has been started as the ``root `` user, the daemon processes
0 commit comments