■httpd
入手
http://httpd.apache.org/download.cgi
$ tar -zxvf httpd-2.x.xx.tar.gz
$ cd /httpd-2.x.xx(xは数字)[リターン]
$ ./configure --enable-so --enable-module=so --enable-module=rewrite
$ make
$ make install
/usr/local/apache2/bin/apachectl start
$ chkconfig --add httpd
$ chkconfig httpd on
■apacheはこっち!
参考http://digibot.jp/tips/linux/003.html
apacheプロジェクトの
ダウンロードページhttp://www.apache.org/dist/httpd/
からhttpd-2.0.46.tar.gz をダウンロードします。解凍してconfigureを設定します。 enable-shared=yesで DSO (Dynamic Shared Objects)を有効にします。DSOについては
@IT http://www.atmarkit.co.jp/flinux/rensai/apache03/apache03e.html#ho03
を参照してください。 以下のコマンドで/usr/local/apache2/にインストールされます。ここではWebDAVの使用を考えていますので --enable-dav=yes を使用していますが必要ない人は外してください。
# tar zxvf httpd-2.0.46.tar.gz
# cd httpd-2.0.46
# ./configure --enable-shared=yes --enable-dav=yes
# make
# make install
設定 httpd.conf
apacheの設定ファイルは /usr/local/apache2/conf/httpd.conf になります。viなどのテキストエディタで開いて最低限の項目を修正します。
# vi /usr/local/apache2/conf/httpd.conf
User apache
Group apache
※nobodyでもOKですが一応apacheというユーザとグループを作成しています。
#ServerName host.domain.com:80
ServerName host.domain.com:80
(#をはずしてIPもしくはドメインを入力)
UseCanonicalName Off
(OnにするとDNSを参照します)
DocumentRoot "/usr/local/apache2/htdocs"
Option Indexes FollwSymLinks ExecCGI
AllowOverride None
Order allow,deny
Allow from all
# PHP Setup ※PHPを後からインストールする場合は
どこでも良いので以下の3行を追加。
PHPINIDir "conf"
(php.iniファイルの場所、この場合は/usr/local/apache2/confを指している)
Addtype application/x-httpd-php .php
LoadModule php4_module modules/libphp4.so
#AddHandler cgi-script .cgi
AddHandler cgi-script .cgi .pl
(コメントアウトして .pl も追加しておく)
httpd.confのエラーをチェックするには以下のコマンドで確認できます。
# /usr/local/apache2/bin/apachectl configtest
起動スクリプトの作成
それぞれのランレベルで起動されるように、起動スクリプトとリンクを張ります。 私の場合はrunレベル3.4.5に起動、0に終了のシンボリックリンクを作成しています。 以下のファイルを/etc/rc.d/init.d/へファイル名httpdとして保存する。
# vi /etc/rc.d/init.d/httpd
#!/bin/sh
#
# Startup script for the Apache Web Server
#
# chkconfig: 345 85 15
# prpcessname: httpd
# pidfile: /usr/local/apache2/logs/httpd.pid
# config: /usr/local/apache2/conf/httpd.conf
#Source function library.
. /etc/rc.d/init.d/functions
# See how we were called.
case "$1" in
start)
echo -n "Starting apache: "
/usr/local/apache2/bin/apachectl start
echo
;;
stop)
echo -n "Shutting down apache: "
/usr/local/apache2/bin/apachectl stop
echo
;;
status)
status httpd
;;
restart)
/usr/local/apache2/bin/apachectl restart
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit 0
保存した後、実行権限を与えます。
# chmod 755 /etc/rc.d/init.d/httpd
各runレベルへシンボリックリンクを貼る。
# ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc3.d/S80httpd
# ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc4.d/S80httpd
# ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc5.d/S80httpd
runレベル0のLinux停止と同時にhttpdの終了
# ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc0.d/K10httpd
起動確認として以下のコマンドを実行してみる
# /etc/rc.d/init.d/httpd start
Starting apache が表示されればOK。あとはPCの起動、停止に合わせて自動実行してくれる。
□エラーについて
undefined symbol: zend_parse_parameters
こうなった場合はphpをmake distcleanして再make
■PHP
参考
http://www.aconus.com/~oyaji/www/apache_linux_php.htm
入手
http://www.php.net/downloads.php
PHP関係のrpmの削除
$ rpm -qa | grep php
$ rpm -qa | grep php | xargs rpm -e
PHPのインストール
tar zxfv php4-STABLE-200306300130.tar.gz
$ cd php-4.3.2
$ ln -s /usr/include/mysql /usr/mysql
$ ./configure \
--with-apxs2=/usr/local/apache2/bin/apxs \
--enable-mbstring \
--enable-mbregex \
--enable-zend-multibyte \
--with-gd \
--enable-gd-native-ttf \
--with-freetype-dir=/usr \
--with-png-dir=/usr \
--with-zlib \
--with-jpeg-dir=/usr \
--with-pgsql=/usr \
--with-mysql=/usr
$ make
$ su
# make install
PHPの設定
# cp php.ini-dist /usr/local/lib/php.ini
# vi /usr/local/lib/php.ini
output_buffering = On
output_handler = mb_output_handler
default_charset = Shift_JIS
session.save_path = /tmp/php
[mbstring]
mbstring.language = Japanese
mbstring.internal_encoding = EUC-JP
mbstring.http_input = auto
mbstring.http_output = SJIS
mbstring.encoding_translation = On
mbstring.detect_order = auto
mbstring.substitute_character = none;
mbstring.script_encoding = auto
設定内容
output_buffering = On : 出力バッファリングを有効
output_handler = mb_output_handler : 出力の変換を有効にするためにmb_output_handlerを指定
default_charset = Shift_JIS : PHPがContent-type:ヘッダで character encodingを出力するコードを指定
session.save_path = /tmp/php : セッションのデータが保存されるディレクトリ
mbstring.language = Japanese : mbstringで使用される言語のデフォルト値
mbstring.internal_encoding = EUC-JP : 内部文字エンコーディングのデフォルト値
mbstring.http_input = auto : HTTP入力文字エンコーディングのデフォルト値
mbstring.http_output = SJIS : HTTP出力文字エンコーディングのデフォルト値
mbstring.encoding_translation = On : HTTP入力文字エンコーディング検出および内部文字エンコーディングへの変換
mbstring.detect_order = auto : 文字コード検出のデフォルト値
mbstring.substitute_character = none; : 無効な文字を代替する文字
mbstring.script_encoding = auto : PHPスクリプトのエンコーディングを指定(ASCII,JIS,UTF-8,EUC-JP,SJISに展開)
■ApacheのPHP関連の設定
# vi /usr/local/apache2/conf/httpd.conf
LoadModule php4_module modules/libphp4.so
AddType application/x-httpd-php .php
DirectoryIndex index.html index.htm index.html.var index.php
[Esc]、[:]、[w]、[q]で保存。
# /etc/rc.d/init.d/httpd2 restart
|
Apache 2.0とTomcat 5.0の連携
dnotifyを利用する場合
SQLのテクニックを記
Oracleのテクニックを記
VARCHAR2をNUMBERに変換する際、桁数で怒られるときに桁数を無視するfunction
tracの設定メモ
inotifyを利用する場合
監視サーバーの設
SSLキー作
監視サーバーの設
|