windows環境從apache2.2改成apache2.4后httpd.conf中的設置異同。
1、權限設定方式變更
2.2使用Order Deny / Allow的方式,2.4改用require
apache2.2:
Order deny,allow
Deny from all
apache2.4:
Require all denied
此處比較常用的有如下幾種:
Require all denied Require all granted Require host xxx.com Require ip 192.168.1 192.168.2 Require local
注意:若有設定在htaccess文件中的也要修改
2、設定日志記錄方式變更
RewriteLogLevel 指令改為 logLevel
LOGLEVEL設置第一個值是針對整個Apache的預設等級,后方可以對指定的模塊修改此模塊的日志記錄等級
比如:
LogLevel warn rewrite: warn
3、Namevirtualhost 被移除
4、需載入更多的模塊
開啟Gzip在apache2.2中需載入mod_deflate,apache2.4中需載入mod_filter和mod_deflate
開啟ssl在apache2.2中需載入mod_ssl,apache2.4中需載入mod_socache_shmcb和mod_ssl
5、在windows環境建議的設置
EnableSendfile Off EnableMMAP Off
當Log日志出現AcceptEx failed等錯誤時建議設置
AcceptFilter http none AcceptFilter https none
說明:Win32DisableAcceptEx在apache2.4中被AcceptFilter None取代
6、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,可設定多個
更多Apache相關技術文章,請訪問Apache使用教程欄目進行學習!