httpdの設定(オレオレ)
前準備
httpdをインストールする。
設定
yum install httpd
httpd.conf の編集
こちら。バックアップもわすれずに
編集対象ファイルはこちら
/etc/httpd/conf/httpd.conf
変更箇所(最低限の設定ですが・・・)
エラー時のサーバトークンを最低限にする
変更前
43 # finding out what major optional modules you are running
44 ServerTokens OS
変更後
43 # finding out what major optional modules you are running
44 ServerTokens Prod
キープアライブ系の設定を変更
変更前
67 #
68 # Timeout: The number of seconds before receives and sends time out.
69 #
70 Timeout 60
71
72 #
73 # KeepAlive: Whether or not to allow persistent connections (more than
74 # one request per connection). Set to "Off" to deactivate.
75 #
76 KeepAlive Off
77
78 #
79 # MaxKeepAliveRequests: The maximum number of requests to allow
80 # during a persistent connection. Set to 0 to allow an unlimited amount.
81 # We recommend you leave this number high, for maximum performance.
82 #
83 MaxKeepAliveRequests 100
変更後
67 #
68 # Timeout: The number of seconds before receives and sends time out.
69 #
70 Timeout 10
71
72 #
73 # KeepAlive: Whether or not to allow persistent connections (more than
74 # one request per connection). Set to "Off" to deactivate.
75 #
76 KeepAlive On
77
78 #
79 # MaxKeepAliveRequests: The maximum number of requests to allow
80 # during a persistent connection. Set to 0 to allow an unlimited amount.
81 # We recommend you leave this number high, for maximum performance.
82 #
83 MaxKeepAliveRequests 100
サーバ名変更
変更前
260 # as error documents. e.g. admin@your-domain.com
261 #
262 ServerAdmin root@localhost
(中略)
274 # redirections work in a sensible way.
275 #
276 #ServerName www.example.com:80
変更後
260 # as error documents. e.g. admin@your-domain.com
261 #
262 ServerAdmin hoge@fuga.com
(中略)
274 # redirections work in a sensible way.
275 #
276 ServerName 192.168.33.10:80
メールアドレスやサーバ名の部分は、各自適切なものを入れてください
htaccessなどでの設定の上書きを許可
変更前
336 # Options FileInfo AuthConfig Limit
337 #
338 AllowOverride None
339
変更後
336 # Options FileInfo AuthConfig Limit
337 #
338 AllowOverride All
339
厳密な意味では、Allはまずいが・・・。
index.phpなどを追加
変更前
400 # same purpose, but it is much slower.
401 #
402 DirectoryIndex index.html index.html.var
変更後
400 # same purpose, but it is much slower.
401 #
402 DirectoryIndex index.html index.html.var index.htm index.php
サーバシグニチャは表示しない
変更前
534 # Set to one of: On | Off | EMail
535 #
536 ServerSignature On
変更後
534 # Set to one of: On | Off | EMail
535 #
536 ServerSignature Off
デフォルトUTF-8は削除
変更前
756 # in HTML content to override this choice, comment out this
757 # directive:
758 #
759 AddDefaultCharset UTF-8
変更後
756 # in HTML content to override this choice, comment out this
757 # directive:
758 #
759 #AddDefaultCharset UTF-8
おまけ:確認用に即席htmlファイルを
確認にhtmlファイル
echo "Hello works!!" >> /var/www/html/index.html