Linux/Apache2.2インストール の変更点


*CentOS5.2でApache2.2インストール [#t66c8ba6]

[[dokuwiki.fl8.jp転載済み>http://dokuwiki.fl8.jp/doku.php/01_linux/02_www/apache2.2%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB]]

**環境 [#j8900ccc]
 CentOS5.2
 Apache2.2.9
 mod_rewrite
 mod_ssl

**コンフィグ [#v5471bcf]
 # tar zxvf httpd-2.2.9.tar.gz
 # cd httpd-2.2.9
 # ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite=shared --enable-ssl --enable-speling=shared
 ・
 ・
 ・
 configure: error: ...No recognized SSL/TLS toolkit detected

&color(Red){enable-speling=sharedはmod_spelingを使用する場合に。};

**エラー対処 [#t6023595]
これでコンフィグ通ります。
 # yum install openssl-devel

**起動スクリプト用意 [#s54c2a95]
 # cp /usr/local/src/httpd-2.2.14/build/rpm/httpd.init /etc/init.d/httpd
 # chmod 755 /etc/init.d/httpd

-PATHの修正
 # vi /etc/init.d/httpd
     54 #apachectl=/usr/sbin/apachectl
     55 apachectl=/usr/local/apache2/bin/apachectl
     56 #httpd=${HTTPD-/usr/sbin/httpd}
     57 httpd=${HTTPD-/usr/local/apache2/bin/httpd}
     58 prog=httpd
     59 #pidfile=${PIDFILE-/var/log/httpd/httpd.pid}
     60 pidfile=${PIDFILE-/usr/local/apache2/logs/httpd.pid}

-chkconfigに登録
 # /sbin/chkconfig --add httpd
 # /sbin/chkconfig httpd on

-スタート
 # /sbin/service httpd start

** Apache起動で変なエラー[#q74152ca]
 httpd: Syntax error on line 55 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server: /usr/local/apache2/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied
「SELinuxポリシーが適用されて、エラーの出たライブラリの

セキュリティコンテキストが適切に設定されていない」ことを意味するそうです。

***対処 [#rfd055f8]
&color(Red){SELinuxを無効にする};か、下のコマンド
 chcon -c -v -R -u system_u -r object_r -t textrel_shlib_t libphp5.so

**PHP [#yd23a7d5]
 ./configure --with-apxs2=/usr/local/apache2/bin/apxs \
 --with-mysql=/usr/local \
 --with-pgsql=/usr/local/pgsql \
 --enable-cli \
 --enable-pear \
 --with-tsrm-pth \
 --with-gd --with-zlib \
 --with-freetype-dir=/usr/local \
 --with-jpeg-dir=/usr/local \
 --with-png-dir=/usr/local \
 --enable-force-cgi-redirect \
 --enable-mbstring \
 --enable-mbstr-enc-trans \
 --enable-trans-sid \
 --enable-versioning \
 --enable-gd-native-ttf \
 --enable-gd-jis-conv

**httpd.confに追加 [#u68393c2]
 AddType application/x-httpd-php .php .html