博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Ubuntu 14.04 Apache 从 2.2 迁移至 2.4 重要提示
阅读量:6161 次
发布时间:2019-06-21

本文共 3538 字,大约阅读时间需要 11 分钟。

hot3.png

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 . 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 Hosts

Starting 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:

Order allow,deny

Allow from all

New 2.4 virtual host configuration:

Require all granted

.htaccess problems

If 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 module

From 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 about

There are a few other changes that you should consider, although they generally result in an warning and not an error:

  • MaxClients has been renamed to MaxRequestWorkers, which describes more accurately what it does. For async MPMs, like event, the maximum number of clients is not equivalent than the number of worker threads. The old name is still supported.

  • The DefaultType directive no longer has any effect, other than to emit a warning if it's used with any value other than none. You need to use other configuration settings to replace it in 2.4.

  • EnableSendfile now defaults to Off.

  • FileETag now defaults to "MTime Size" (without INode).

  • KeepAlive only accepts values of On or Off. Previously, any value other than "Off" or "0" was treated as "On".

  • Directives AcceptMutex, LockFile, RewriteLock, SSLMutex, SSLStaplingMutex, and WatchdogMutexPath have been replaced with a single Mutex directive. You will need to evaluate any use of these removed directives in your 2.2 configuration to determine if they can just be deleted or will need to be replaced using Mutex.

- See more at: http://linoxide.com/linux-how-to/apache-migration-2-2-to-2-4-ubuntu-14-04/#sthash.WLSASjaD.dpuf

转载于:https://my.oschina.net/HeAlvin/blog/377353

你可能感兴趣的文章
[学习笔记]标记永久化
查看>>
Android把自己应用加入到系统文件分享中
查看>>
SQL Server安装计划
查看>>
写在山理工之行之后。
查看>>
检查DISPLAY设置时Xlib出现No protocol specified错误
查看>>
如何使用Photoshop制作真实的尺子
查看>>
linux 再多的running也挡不住锁
查看>>
算法笔记--字符串hash
查看>>
strak组件(9):关键字搜索
查看>>
ReactNative 常见红屏黄屏及终端报错
查看>>
[xsy3343]程序锁
查看>>
线性模型(1) —— 多元线性回归
查看>>
PHP函数——urlencode() 函数
查看>>
Net性能分析与调试培训资料
查看>>
VB.NET 开发ColorPicker例子
查看>>
按照指定字符(@split )分割字符串,并取第@index 个
查看>>
Android判断当前线程是否是主线程的方法
查看>>
DBA日常工作内容和职责
查看>>
【Python爬虫学习实践】基于BeautifulSoup的网站解析及数据可视化
查看>>
百度api:根据经纬度获取地理位置信息
查看>>