ソースからApacheインストール

apacheインストール参考
http://2php.jp/php/install_apache_linux.html

# cd /
# mkdir /download
# cd download
# wget http://ftp.riken.jp/net/apache/httpd/httpd-2.2.8.tar.gz

展開

# tar -xzf httpd-2.2.8.tar.gz
**||<

**インストール
>||
# ./configure --enable-so --enable-module=so --enable-module=rewrite
# make
# make install
/usr/local/apache2/bin/apachectl start
httpd: Could not reliably determine the server's fully qualified domain
name, using 127.0.0.1 for ServerName
httpd (pid 22131) already running

起動しているのかしていないのかわからないので調べる

[root@webtest2 ~]# /usr/local/apache2/bin/apachectl restart
httpd: Could not reliably determine the server's fully qualified domain
name, using 127.0.0.1 for ServerName
httpd not running, trying to start
[root@webtest2 ~]# /usr/local/apache2/bin/apachectl start
httpd: Could not reliably determine the server's fully qualified domain
name, using 127.0.0.1 for ServerName
httpd (pid 22199) already running

参考:apacheが起動しない
http://oshiete1.goo.ne.jp/qa973701.html

すでにapacheが入っている?

[root@webtest2 init.d]# ./httpd stop
Stopping httpd: [ OK ]
[root@webtest2 init.d]# /usr/local/apache2/bin/apachectl start
httpd: Could not reliably determine the server's fully qualified domain
name, using 127.0.0.1 for ServerName

ファイアーウォールが原因と教えてもらう、下のURL教えてもらう

FC4/SELinux/SELinux を無効にするには?
http://pocketstudio.jp/linux/?FC4%2FSELinux%2FSELinux%20%A4%F2%CC%B5%B8%FA%A4%CB%A4%B9%A4%EB%A4%CB%A4%CF%A1%A9
iptablesの設定
http://linux.shoukun.com/security/iptables.htm

#vi /etc/selinux/config
【6行目】SELINUX=enforcingをdisabledに変更
# iptables -A INPUT -p tcp --dport 80 -j ACCEPT
# iptables -A INPUT -p tcp --sport 80 -j ACCEPT
# /etc/init.d/iptables save
# service iptables restart 
# reboot

アクセスできない
CentOS 5 で iptables と SELinux の設定でつまずく
http://jamz.jp/tech/2007/05/not-work-iptables-and-selinux.html

windowsコマンドプロンプトpingを行ったところもちろん接続は確認された

原因が何かわからないので無効にしてアクセスしてみる

Linuxファイアウォールを無効化する
http://www.dreamhound.net/ja/blog/2008/01/linux.html

# iptables -F

IEでアクセスするとhttp://192.168.20.236/
It works!が表示された
apche起動してない?「あなたの予想に反して…」がでない

# service iptables restart

「接続できませんでした」メッセージ。iptblesの設定をなんとかしないと

Apache2.2から「あなたの予想に反して…」から「It Works!]が正しいことを聞いた

ということで、Apache起動してた。
iptableの設定を変えれば大丈夫ということ
Selinuxはdisabledにする必要はないみたい
Selinuxは本番環境で無効にすることがほとんどであるらしい

iptableに関して
第4回 Linuxで作るファイアウォール[NAT設定編]
http://www.atmarkit.co.jp/flinux/rensai/security04/security04a.html

「It Works!」を確認。動いた

CGIを使用できるように設定してみよう!!

http://vine-linux.ddo.jp/linux/apache/cgi.php
/etc/httpd/conf/httpd.confを編集する。バックアップもとる

# AddHandler cgi-script .cgi
↓
AddHandler cgi-script .cgi .pl

ScriptAlias /cgi-bin/ /home/*/public_html/cgi-bin/
<Directory />
	Options FollowSymLinks
	AllowOverride None
</Directory>
<Directory /home/*/public_html/cgi-bin>
	AllowOverride None
	Options ExecCGI
	Order allow,deny
	Allow from all
</Directory>

test.cgi動作確認