0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Apache2.2+OpenSSL1.0.2 ソースからインストール

Last updated at Posted at 2018-10-15

##はじめに
apache2.2系はすでにEOLしていますが、このバージョンでインストールしたい方もいるかもしれないので投稿

##環境

  • apache2.2
  • openssl1.0.1系
  • CentOS 5, 6, 7

##★Apache2.2のconfigureについて
参考
http://httpd.apache.org/docs/2.2/programs/configure.html#synopsis

以下のインストール方法で--enable-mods-sharedは全部入りを目指しているが「ldap」を指定すると、
mod_ldap.so が古いopensslライブラリを参照していて、起動しないのでldapは外しています。

##インストール
###OpenSSL

  • コンパイル
./config shared zlib --prefix=/usr/local/openssl-1.0.2p
make && make install
  • バージョン情報隠蔽
cd /usr/local
ln -s openssl-1.0.2n openssl
  • 共通ライブラリパス追加
cat <<EOT >  /etc/ld.so.conf.d/openssl.conf
/usr/local/openssl/lib
EOT

ldconfig

###Apache2.2

  • 基本
./configure --prefix=/usr/local/httpd-2.2.34 \
--with-mpm=prefork \
--enable-mods-shared="all ssl cache proxy authn_alias mem_cache file_cache charset_lite dav_lock disk_cache" \
--with-ssl=/usr/local/openssl

make && make install
  • aprもソースから入れる場合
cd srclib/apr
./configure --prefix=/usr/local/apr-httpd-2.2.34/
make && make install

cd srclib/apr-util
./configure --prefix=/usr/local/apr-util-httpd-2.2.34/ --with-apr=/usr/local/apr-httpd-2.2.34/
make && make install


./configure --prefix=/usr/local/httpd-2.2.34 \
--with-mpm=prefork \
--enable-mods-shared="all ssl cache proxy authn_alias mem_cache file_cache charset_lite dav_lock disk_cache" \
--with-ssl=/usr/local/openssl \
--with-apr=/usr/local/apr-httpd-2.2.34/ \
--with-apr-util=/usr/local/apr-util-httpd-2.2.34
make && make install
  • バージョン情報隠蔽
ln -s httpd-2.2.34 apache2

##ログローテート
###CentOS6

/usr/local/apache2/logs/*log {
    missingok
    notifempty
    sharedscripts
    postrotate
        /sbin/service httpd-new reload > /dev/null 2>/dev/null || true
    endscript
}

###CentOS7

/usr/local/apache2/logs/*log {
    missingok
    notifempty
    sharedscripts
    compress
    postrotate
        /bin/systemctl reload httpd-2.2.service > /dev/null 2>/dev/null || true
    endscript
}

##起動スクリプト
###CentOS6

cp -p httpd-2.2.32/build/rpm/httpd.init /etc/init.d/httpd-new

vi /etc/init.d/httpd-new

prog=httpd
httpd=${HTTPD-/usr/local/apache2/bin/httpd}
pidfile=${PIDFILE-/usr/local/apache2/logs/${prog}.pid}
lockfile=${LOCKFILE-/usr/local/apache2/logs/${prog}.lock}
CONFFILE=/usr/local/apache2/conf/httpd.conf

###CentOS7

vi /etc/systemd/system/httpd-2.2.service
[Unit]
Description=Apache2.2
After=syslog.target network.target

[Service]
Type=forking
ExecStart=/usr/local/apache2/bin/httpd -k start
ExecReload=/usr/local/apache2/bin/httpd -k graceful
ExecStop=/usr/local/apache2/bin/httpd -k stop

[Install]
WantedBy=multi-user.target
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?