提供:すだちWiki
移動先: 案内検索

ApacheのKeepAliveを使う(CentOS7)

はじめに

KeepAlive(クライアントとのコネクションを保持)とは、HTTP の持続的な接続を有効にする機能のことです。

KeepAliveを使う

httpd.conf編集

最終行に近いところに追加します。

[root@host3 ~]# vi /etc/httpd/conf/httpd.conf
# 追記

# サーバのバージョン情報等を隠す
ServerTokens Prod
ServerSignature Off

# HTTP の持続的な接続 ← 追加
KeepAlive On ← 追加
# 持続的な接続上で許可されるリクエストの数 ← 追加
MaxKeepAliveRequests 30 ← 追加
# 持続的な接続で次のリクエストが来るまでサーバが待つ時間(秒) ← 追加
KeepAliveTimeout 10 ← 追加

# Supplemental configuration
#
# Load config files in the "/etc/httpd/conf.d" directory, if any.
IncludeOptional conf.d/*.conf                                          

Apacheの再起動

[root@host3 ~]# systemctl restart httpd