目录[-]
If you do a distribution upgrade from Ubuntu 12.04 to 14.04, the upgrade will bring among other things an important update to Apache, from version 2.2 to version 2.4. The update brings many improvements but it may cause some errors when used with the old configuration file from 2.2. Access control in Apache 2.4 Virtual HostsStarting with Apache 2.4 authorization is applied in a way that is much more flexible then just a single check against a single data store like it was in 2.2. In the past it was tricky to figure how and in what order authorization is applied but with the introduction of authorization container directives such as and , the configuration also has control over when the authorization methods are called and what criteria determines when access is granted. This is the point where most upgrades fail because of wrong configuration because in 2.2 access control based on IP address, hostname or other characteristic was done using the directives Order, Allow, Deny or Satisfy, but in 2.4 this is done with authorization checks using the new modules. To be clear let's see some virtual host examples, this can be found in your /etc/apache2/sites-enabled/default or /etc/apache2/sites-enabled/YOUR_WEBSITE_NAME: Old 2.2 virtual host configuration:
New 2.4 virtual host configuration:
.htaccess problemsIf after the upgrade some settings don't work or you get redirect errors, check if those settings are in a .htaccess file. If settings in the .htaccess file are not used by Apache it's because in 2.4 AllowOverride directive is set to None by default, thus ignoring the .htaccess files. All you have to do is to either change or add the AllowOverride All directive to your site configuration file. You also see the AllowOverride All directive set in the screenshot above. Missing config file or moduleFrom my experience another problem during upgrades is that your configuration file includes an old module or configuration file that is no longer needed or supported in 2.4, you will get a clear warning that Apache can't include the respective file and all you have to do is go to your configuration file and remove the line that causes problem. Afterwards you can search or install a similar module. Other small changes you shound know aboutThere are a few other changes that you should consider, although they generally result in an warning and not an error:
- See more at: http://linoxide.com/linux-how-to/apache-migration-2-2-to-2-4-ubuntu-14-04/#sthash.WLSASjaD.dpuf (责任编辑:IT) |