Reputation: 1011
I have a problem, I accidentally upgraded from Apache 2.2 to 2.4 and now need to change my httpd.conf file to use the new Require directives instead of using the old Order and Allow directives. I think I have made all the changes I need to but there is one section I am not sure what I should replace it with. This is the section:
<FilesMatch "^\.ht">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>
This combination of Order, Deny and Satisfy confuses me as I am a newb at this. What is the proper 2.4 configuration to accomplish the same thing. I have tried googling an answer and searched this site but haven't found anything (perhaps using the wrong terms - I don't know). If some guru out there could provide some help that would be greatly appreciated.
Thanks!
Upvotes: 2
Views: 14524
Reputation: 1930
i know this question was asked in 2014, but this solution is too good not to be published here...
on the old 2.2 Apache, i prepare the migration with:
<Location />
<IfVersion >= 2.4>
Require all granted
</IfVersion>
<IfVersion < 2.4>
order allow,deny
allow from all
</IfVersion>
</Location>
Depending on the Apache version, the correct configuration-syntax will be used. And it does not matter if you run 2.2 or 2.4 .
Upvotes: 1
Reputation: 459
Here's what I did to get Apache back up and running after upgrading:
Use the new installed apache2.conf file in the 'etc/apache2' directory. This will clear up quite a few errors. The new file has the new 'Require' syntax built in.
change all your VH files in the 'sites-available' directory e.g. xyzsite.com.conf (add '.conf' to the files. Same with the default file. You'll have to change the 'Require' syntax in this file as Henk points out.
The httpd.conf is simply not used, so if you have one you might as well delete it to avoid confusion in the future.
Hope this helps.
Upvotes: 0
Reputation: 2665
In your case Satisfy All
is not needed anymore:
v2.2
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
<FilesMatch "^\.ht">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>
v2.4:
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
Upvotes: 4
Reputation: 329
The idioms have changed in Apache 2.4.
Read through "Upgrading to 2.4 from 2.2" at http://httpd.apache.org/docs/trunk/upgrading.html
Look for these entries:
2.2 configuration:
Order deny,allow
Deny from all
2.4 configuration:
Require all denied
Upvotes: 6