<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[沧海一粟]]></title> 
<link>http://www.dzhope.com/index.php</link> 
<description><![CDATA[Web系统架构与服务器运维,php开发]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[沧海一粟]]></copyright>
<item>
<link>http://www.dzhope.com/post//</link>
<title><![CDATA[Apache 从 2.2 换至 2.4 httpd.conf 的修改 (windows 环境)]]></title> 
<author>jed &lt;jed521@163.com&gt;</author>
<category><![CDATA[服务器技术]]></category>
<pubDate>Wed, 08 Feb 2017 15:56:01 +0000</pubDate> 
<guid>http://www.dzhope.com/post//</guid> 
<description>
<![CDATA[ 
	http://httpd.apache.org/docs/2.4/upgrading.html<br/><br/><a href="http://httpd.apache.org/docs/2.4/new_features_2_4.html" target="_blank">http://httpd.apache.org/docs/2.4/new_features_2_4.html</a><br/><br/> <br/><br/>/*2012.12.25 補充*/<br/><br/>apache 2.4.3 版有對 window 版的 ssl bug 做修正 ，bug 說明 <a href="http://www.apachelounge.com/viewtopic.php?p=22306" target="_blank">http://www.apachelounge.com/viewtopic.php?p=22306</a> <br/><br/>這個 bug 簡而言之就是會讓 443 的頁面連線掛點...<br/><br/> <br/><br/>1. 權限設定方式變更<br/><br/>原本使用 Order Deny / Allow 的方式，改用 Require<br/><br/>官方範例:<br/><br/>2.2 configuration:<br/><br/>Order deny,allow<br/>Deny from all<br/>在 2.4 需要改成<br/><br/>2.4 configuration:<br/><br/>Require all denied<br/>比較常用到的有以下幾種<br/><br/>Require all denied<br/><br/>Require all granted<br/><br/>Require host xxx.com<br/><br/>Require ip 192.168.1 192.168.2<br/><br/>Require local<br/><br/>注意 : 若有設定在 .htaccess 中的也要修改<br/><br/>詳細指令說明 : <a href="http://httpd.apache.org/docs/2.4/mod/mod_authz_core.html#require" target="_blank">http://httpd.apache.org/docs/2.4/mod/mod_authz_core.html#require</a><br/><br/> <br/><br/>2. 設定 Log 紀錄方式變更<br/><br/>RewriteLogLevel 指令 改為 logLevel<br/><br/>LogLevel 設定第一個值是針對整個 Apache 設的預設等級，後方可以對指定的模組修改此模組的 Log 記錄等級<br/><br/>範例:<br/><br/>LogLevel warn rewrite: warn<br/><br/>詳細指令說明 請查看: <a href="http://httpd.apache.org/docs/2.4/mod/core.html#loglevel" target="_blank">http://httpd.apache.org/docs/2.4/mod/core.html#loglevel</a><br/><br/> <br/><br/>3. Namevirtualhost 被移除<br/><br/>雖然我查官方文件是還有 NameVirtualHost 指令，但是執行時會出現錯誤。<br/><br/>官方文件也寫了這個指令目前是無作用的，因此刪掉此設定。<br/><br/>詳細說明: <a href="http://httpd.apache.org/docs/2.4/mod/core.html#namevirtualhost" target="_blank">http://httpd.apache.org/docs/2.4/mod/core.html#namevirtualhost</a><br/><br/> <br/><br/>4. 其他要多載入的模組<br/><br/>使用網站壓縮除了開啟 mod_deflate 外 ，在 Apache 2.4 中還需要多開 mod_filter<br/><br/>使用SSL憑證除了開啟 mod_ssl 外 ，在 Apache 2.4 中還需要多開 mod_socache_shmcb<br/><br/> <br/><br/>5. 在 windows 環境建議的設定<br/><br/>EnableSendfile Off<br/><br/>EnableMMAP Off<br/><br/> <br/><br/>另外，當 Log 有出現 AcceptEx failed 相關錯誤時，建議調整以下設定<br/><br/>AcceptFilter http none <br/><br/>#AcceptFilter https none 這行 apache 2.4.1 設了就不能連443了，所以我沒設定，在 apache 2.4.3 版可正常運作<br/><br/>bug 修正相關文件： <a href="http://www.apachelounge.com/viewtopic.php?p=22306" target="_blank">http://www.apachelounge.com/viewtopic.php?p=22306</a><br/><br/> <br/><br/>指令說明 <a href="http://httpd.apache.org/docs/2.4/mod/core.html#acceptfilter" target="_blank">http://httpd.apache.org/docs/2.4/mod/core.html#acceptfilter</a><br/><br/>備註:&nbsp;&nbsp;Win32DisableAcceptEx 指令在 apache2.4 被 AcceptFilter None 取代<br/><br/>相關參考文章:<br/><br/><a href="http://www.neo.com.tw/archives/000223" target="_blank">http://www.neo.com.tw/archives/000223</a><br/><br/><a href="http://www.iteye.com/news/24881" target="_blank">http://www.iteye.com/news/24881</a><br/><br/><a href="http://www.apachelounge.com/viewtopic.php?t=4450" target="_blank">http://www.apachelounge.com/viewtopic.php?t=4450</a><br/><br/> <br/><br/>6. Listen 的設定調整<br/><br/>以 443 為例，不可以只設定 Listen 443<br/><br/>會出現以下錯誤<br/><br/>(OS 10048)一次只能用一個通訊端位址(通訊協定/網路位址/連接埠)。&nbsp;&nbsp;: AH00072: make_sock: could not bind to address [::]:443<br/><br/>(OS 10048)一次只能用一個通訊端位址(通訊協定/網路位址/連接埠)。&nbsp;&nbsp;: AH00072: make_sock: could not bind to address 0.0.0.0:443<br/><br/>AH00451: no listening sockets available, shutting down<br/><br/>AH00015: Unable to open logs<br/><br/>因此需指定監聽的 IP ，可設定多個<br/><br/>例如:<br/><br/>Listen 192.168.2.1:443<br/><br/>Listen 127.0.0.1:443<br/><br/> <br/><br/>其他異常BUG :<br/><br/>某天突然心血來潮測試了一下可不可以開啟 .htaccess 的檔案，很驚恐的居然可以開啟&nbsp;&nbsp;冏 <br/><br/>原本 httpd.conf 預設不可開啟 .ht* 的設定失效!<br/><div class="code"><br/>&lt;Files &quot;.ht*&quot;&gt;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;Require all denied<br/><br/>&lt;/Files&gt;<br/></div><br/>測試的結果，httpd.conf 裡的 <Files> 跟 <FilesMatch> 完全失效 !<br/><br/>不確定跟 <VirtualHost> 設定有沒有關係 ( 其實我跟 httpd.conf 沒這麼熟，我都是被刀抵著脖子的 =..=a )<br/><br/>經過半天的折磨，最後發現改用 LocationMatch 設定還勉強行得通<br/><br/>因為我沒有用到 htpasswd ，所以比較不怕 .ht* 的檔案被開啟 ....所以就先用這種跛腳的方式解決了.....<br/><br/>例如:<br/><div class="code"><br/>&lt;LocationMatch &quot;&#92;.svn&quot;&gt;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp; Require all denied<br/><br/>&lt;/LocationMatch&gt;<br/></div><br/>注意: 子階層的 LocationMatch 設定，指令要設在母階層的行數之下，不然會被覆蓋<br/><br/>且不可以對 " .ht* " 設定!!<br/><br/>因為 Server 就無法讀取 .ht* 的資料...當然裡面的設定就不能跑了<br/><br/> <br/><br/>另外就是 .htaccess 中，<Files> 跟 <FilesMatch> 可能會失效<br/><br/>而且 .htaccess 裡無法設定 LocationMatch .........(嘆氣)<br/><br/>在我的環境中，Server 2008 的 .htaccess 有生效，<br/><br/>但是在 Win7 環境中，放在第二層資料夾的 .htaccess 有生效 ，若第三層資料夾才放&nbsp;&nbsp;.htaccess 就會失效<br/><br/><br/>Tags - <a href="http://www.dzhope.com/tags/apache/" rel="tag">apache</a>
]]>
</description>
</item><item>
<link>http://www.dzhope.com/post//#blogcomment</link>
<title><![CDATA[[评论] Apache 从 2.2 换至 2.4 httpd.conf 的修改 (windows 环境)]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.dzhope.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>