Apacheの手動インストール
さて、やるか。
まずはapacheを持ってきましょう。
cd /usr/local/src/ wget http://www.meisei-u.ac.jp/mirror/apache/dist//httpd/httpd-2.0.64.tar.gz
したら解凍しましょう
tar zxvf httpd-2.0.64.tar.gz
解凍先に移動
cd httpd-2.0.64
./configure --enable-module=so --enable-rule=SHARED_CORE --enable-module=mod_rewrite
make&install
make makeinstall
起動テストします
/usr/local/apache2/bin/apachectl start
ここまできたらブラウザからアクセスしましょう〜
「あなたの予想に反して、このページが見えているでしょうか?」
と出ればおk。
2.2系とかだとi'ts Work
だっけ?そんなんが出るはず。
一回apacheとめます。
/usr/local/apache2/bin/apachectl stop
chkconfigで自動起動設定したいのでここにコピーして
cd /etc/rc.d/init.d/ cp /usr/local/src/httpd-2.0.64/build/rpm/httpd.init ./ mv httpd.init httpd
init.dのhttpdから設定ファイルを変更
cd /etc/init.d/ vi httpd
viで開いたらこれを追加
#!/bin/bash # chkconfig: 345 98 20 # description: Watch system status # processname: hotsanic #
これでchkconfigにaddできるようになるから
chkconfig --add httpd
エラーが起きたら何か間違ってます〜
リストだけ確認しておきましょう
chkconfig --list | grep httpd httpd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
で、servicdeから起動します。
/etc/init.d/httpd start Starting httpd: grep: /etc/httpd/conf/httpd.conf: No such file or directory /bin/bash: /usr/sbin/httpd: No such file or directory
えらーかよw
パスが間違ってるって言われましたw
vi /etc/init.d/httpd
直す箇所はこの2つ
httpd=${HTTPD-/usr/local/apache2/bin/httpd} と CONFFILE=/usr/local/apache2/conf/httpd.conf
自分の環境だとこんな感じ
もう一回起動
/etc/init.d/httpd start Starting httpd: [ OK ]
はいおk−。
でもいままでこれrootで作業してたからこのままだと
これからの実装に支障があるかも、なのでユーザーとグループ変更
groupadd apache useradd -g apache -d /var/empty/ -s /sbin/nologin apache cd /usr/local/ chown -R apache apache2/ chgrp -R apache apache2/
これでおkだけど最後にconfの設定を変えましょうー
vi /usr/local/apache2/conf/httpd.conf
これでUserとGroupをapacheに変えればおk!
最後に確認しておきましょう
/etc/init.d/httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ]
プロセスの実行ユーザーがapacheになっていることを確認
ps aux | grep httpd root 13074 0.0 0.3 31292 1848 ? Ss 17:03 0:00 /usr/local/apache2/bin/httpd apache 13076 0.0 0.2 31292 1392 ? S 17:03 0:00 /usr/local/apache2/bin/httpd apache 13077 0.0 0.2 31292 1392 ? S 17:03 0:00 /usr/local/apache2/bin/httpd apache 13078 0.0 0.2 31292 1392 ? S 17:03 0:00 /usr/local/apache2/bin/httpd apache 13079 0.0 0.2 31292 1392 ? S 17:03 0:00 /usr/local/apache2/bin/httpd apache 13080 0.0 0.2 31292 1392 ? S 17:03 0:00 /usr/local/apache2/bin/httpd root 13082 0.0 0.1 6024 644 pts/0 S+ 17:03 0:00 grep httpd