Apacheメモ。

ヘッダや404ページでソフトのバージョンとかを出さない

ServerTokens Prod   # Headerから情報を消す
ServerSignature Off # Errorページ等から情報を消す

※Apache2xではServerTokensだけで両方消える。

fakemac:~% HEAD http://localhost/foo
404 Not Found
Connection: close
Date: Mon, 23 Jan 2006 09:45:43 GMT
<strong>Server: Apache/2.0.55 (Debian) PHP/4.4.0-4</strong>
Content-Type: text/html; charset=iso-8859-1
Client-Date: Mon, 23 Jan 2006 09:45:43 GMT
Client-Peer: 127.0.0.1:80
Client-Response-Num: 1
fakemac:~% GET http://localhost/foo
&lt;!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"&gt;
&lt;html&gt;&lt;head&gt;
&lt;title&gt;404 Not Found&lt;/title&gt;
&lt;/head&gt;&lt;body&gt;
&lt;h1&gt;Not Found&lt;/h1&gt;
&lt;p&gt;The requested URL /foo was not found on this server.&lt;/p&gt;
&lt;hr&gt;
<strong>&lt;address&gt;Apache/2.0.55 (Debian) PHP/4.4.0-4 Server at localhost Port 80&lt;/address&gt;</strong>
&lt;/body&gt;&lt;/html&gt;

これが、

fakemac:~% HEAD http://localhost/foo
404 Not Found
Connection: close
Date: Mon, 23 Jan 2006 09:46:01 GMT
<strong>Server: Apache</strong>
Content-Type: text/html; charset=iso-8859-1
Client-Date: Mon, 23 Jan 2006 09:46:01 GMT
Client-Peer: 127.0.0.1:80
Client-Response-Num: 1
fakemac:~% GET http://localhost/foo
&lt;!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"&gt;
&lt;html&gt;&lt;head&gt;
&lt;title&gt;404 Not Found&lt;/title&gt;
&lt;/head&gt;&lt;body&gt;
&lt;h1&gt;Not Found&lt;/h1&gt;
&lt;p&gt;The requested URL /foo was not found on this server.&lt;/p&gt;
&lt;hr&gt;
<strong>&lt;address&gt;Apache Server at localhost Port 80&lt;/address&gt;</strong>
&lt;/body&gt;&lt;/html&gt;

こうなる。(さっそくGETを使い始めた野郎)

Comments


Option