httpa-apacheソースからインストール手順

apache専用ユーザー作成(nologin-user)

# groupadd -g 620 apache

# useradd -u 620 -g apache -s /sbin/nologin -M apache

httpdソースをダウンロード&解凍

# cd /usr/local/src/

# wget https://www.apache.org/dist/httpd/httpd-2.2.27.tar.gz

# tar xvzf httpd-2.2.27.tar.gz

インストールを行う

# cd httpd-2.2.27

# ./configure --prefix=/usr/local/httpd-2.2.27 --libdir=/usr/local/httpd-2.2.27/lib64 --enable-rewrite=shared --enable-ssl=shared --enable-deflate --enable-headers=shared --enable-proxy=shared --enable-so --enable-proxy-ajp=shared --enable-proxy-balancer=shared --with-ssl

# make

# make install

# ln -s httpd-2.2.27/ httpd

# chown –R apache.apache /usr/local/httpd-2.2.27

httpd.confファイル設定

# vim /usr/local/httpd/conf/httpd.conf


User apache
Group apache

ServerName 127.0.0.1:80

ErrorLog "/var/log/httpd/error_log"

CustomLog "/var/log/httpd/access_log" common


起動設定

# cp /usr/local/src/httpd-2.2.27/build/rpm/httpd.init /etc/rc.d/init.d/httpd

# chmod 755 /etc/init.d/httpd

# vi /etc/init.d/httpd


httpd=${HTTPD-/usr/local/httpd/bin/httpd}
pidfile=${PIDFILE-/usr/local/httpd/logs/httpd.pid}
# check for 1.3 configuration
check13 () {
        CONFFILE=/usr/local/httpd/conf/httpd.conf

サーバーと同時起動

# chkconfig httpd on

httpd 起動


# service httpd start
Starting httpd:                                            [  OK  ]

SSL導入

秘密鍵、証明書、中間証明書ファイルを/usr/local/httpd/confにコピーしておく。

httpd-ssl.conf設定

# vim /usr/local/httpd/conf/extra/httpd-ssl.conf


ServerName 127.0.0.1:443

ErrorLog "/var/log/httpd/ssl_error_log"
TransferLog "/var/log/httpd/ssl_access_log"

SSLCertificateFile "/usr/local/httpd-2.2.27/conf/server.crt"

SSLCertificateKeyFile "/usr/local/httpd-2.2.27/conf/server.key"

SSLCertificateChainFile "/usr/local/httpd-2.2.27/conf/server-ca.crt"

httpd.confでhttpd-ssl.confをIncludeする

# vim /usr/local/httpd/conf/httpd.conf


# Secure (SSL/TLS) connections
Include conf/extra/httpd-ssl.conf

httpd再起動(パス入力を含めて)


# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: Apache/2.2.27 mod_ssl/2.2.27 (Pass Phrase Dialog)
Some of your private key files are encrypted for security reasons.
In order to read them you have to provide the pass phrases.

Server 127.0.0.1:443 (RSA)
Enter pass phrase:

OK: Pass Phrase Dialog successful.
                                                           [  OK  ]