一、权限设定方式变动apache
2.2使用Order Deny / Allow的方式,2.4改用Requirewindows
apache2.2:socket
Order deny,allow Deny from all
apache2.4:ui
Require all denied
此处比较经常使用的有以下几种:spa
Require all denied日志
Require all grantedcode
Require host xxx.comorm
Require ip 192.168.1 192.168.2ip
Require localssl
注意:如有设定在htaccess文件中的也要修改
二、设定日志纪录方式变动
RewriteLogLevel 指令改成 logLevel
LOGLEVEL设置第一个值是针对整个Apache的预设等级,后方能够对指定的模块修改此模块的日志记录等级
好比:
LogLevel warn rewrite: warn
三、Namevirtualhost 被移除
四、需载入更多的模块
开启Gzip在apache2.2中需载入mod_deflate,apache2.4中需载入mod_filter和mod_deflate
开启SSL在apache2.2中需载入mod_ssl,apache2.4中需载入mod_socache_shmcb和mod_ssl
五、在windows环境建议的设置
EnableSendfile Off EnableMMAP Off
当Log日志出现AcceptEx failed等错误时建议设置
AcceptFilter http none AcceptFilter https none
说明:Win32DisableAcceptEx在apache2.4中被AcceptFilter None取代
六、Listen设定的调整
以443为例,不能够只设定Listen 443
会出现如下错误:
(OS 10048)一次只能用一个通信端地址(通信协定/网路位址/链接) : AH00072: make_sock: could not bind to address [::]:443
(OS 10048)一次只能用一个通信端地址(通信协定/网路位址/链接) : AH00072: make_sock: could not bind to address 0.0.0.0:443
AH00451: no listening sockets available, shutting down
AH00015: Unable to open logs
所以需指定监听的IP,可设定多个
例如:
Listen 192.168.2.1:443 Listen 127.0.0.1:443