apache(httpd) 2.4 と、php7.3でのソースインストールのメモ。
さくらのVPSで行いました。
# cat /etc/centos-release CentOS Linux release 7.7.1908 (Core)
と、CentOS 7.7です。
目次
初期設定
まで、行います。
apache (httpd) 2.4
aprとapr-utilをインストールします。
apr
# yum groupinstall "Development Tools" # yum install expat-devel
# wget https://www-eu.apache.org/dist/apr/apr-1.7.0.tar.gz # tar xzvf apr-1.7.0.tar.gz # cd apr-1.7.0 # ./configure # make # make install
↑configureのときに
config.status: creating test/Makefile config.status: creating test/internal/Makefile config.status: creating include/arch/unix/apr_private.h config.status: executing libtool commands rm: cannot remove 'libtoolT': No such file or directory config.status: executing default commands
↑というエラーが出てしまったら、
# vi configure 31880行目 $RM "$cfgfile" ↓ $RM -f "$cfgfile"
↑と、configureファイルの中身を変更します(2020-06-11 追加)
apr-util
# wget https://www-eu.apache.org/dist//apr/apr-util-1.6.1.tar.gz # tar xzvf apr-util-1.6.1.tar.gz # cd apr-util-1.6.1/ # ./configure --with-apr=/usr/local/apr # make # make install
apache (httpd) 2.4
# wget https://www-us.apache.org/dist//httpd/httpd-2.4.41.tar.gz # tar xzvf httpd-2.4.41.tar.gz # cd httpd-2.4.41 # ./configure --enable-suexec --enable-ssl --with-suexec-caller=www --with-suexec-userdir=web --with-suexec-docroot=/home --with-suexec-logfile=/usr/local/apache2/logs/suexec_log --with-suexec-uidmin=100 --with-suexec-gidmin=100 --with-suexec-safepath=/bin:/usr/bin --enable-module=so --enable-module=rewrite --enable-modules=ssl # make # make install
firewallを設定
# firewall-cmd --add-service=http --zone=public --permanent # firewall-cmd --add-service=https --zone=public --permanent # firewall-cmd --reload
PHP 7.3
# yum install libxml2-devel # yum install libcurl-devel # yum install libjpeg-devel # yum install libpng-devel # yum install libXpm-devel # yum install libwebp-devel
# wget https://www.php.net/distributions/php-7.3.13.tar.gz # tar xzvf php-7.3.13.tar.gz # cd php-7.3.13/ # ./configure --with-apxs2=/usr/local/apache2/bin/apxs -with-mysqli --with-pdo-mysql --with-mysqli --enable-mbstring --enable-pcntl --enable-mbstring --enable-ftp --with-gd --with-jpeg-dir -with-webp-dir=/usr --with-xpm-dir=/usr --with-png-dir --with-zlib --enable-zip --without-libzip --with-libxml-dir=/usr --with-freetype-dir=/usr --enable-gd-jis-conv --enable-cgi --with-curl --enable-intl --with-gettext=/usr/local # make # make install
# php -v PHP 7.3.13 (cli) (built: Jan 11 2020 15:26:59) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.13, Copyright (c) 1998-2018 Zend Technologies
php.iniの設定
本番稼働時のphp.iniは
# cp php.ini-production /usr/local/lib/php/php.ini
開発用のphp.iniは
# cp php.ini-development /usr/local/lib/php/php.ini
を設定ファイルとして、設定します。
SSL
# yum install certbot # wget https://dl.eff.org/certbot-auto # chmod 755 certbot-auto # ./certbot-auto certonly --webroot -w /var/www/html/ -d (ドメイン)--renew-by-default --email (連絡先メールアドレス)
# vi /usr/local/apache2/conf/httpd.conf #LoadModule ssl_module modules/mod_ssl.so ↓ LoadModule ssl_module modules/mod_ssl.so #LoadModule socache_shmcb_module modules/mod_socache_shmcb.so ↓ LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
# vi /usr/local/apache2/conf/extra/httpd-ssl.conf #SSLCipherSuite HIGH:MEDIUM:!MD5:!RC4:!3DES ↓ SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5:!SEED:!IDEA:!3DES:!RC4:!DH #SSLProtocol all -SSLv3 ↓ SSLProtocol all -SSLv2 -SSLv3