Apacheの設定
1.インストール
=>OS導入時にデフォルトで導入済
確認:
[root@yslx01 root]# rpm -qa|grep httpd
httpd-2.0.40-21
httpd-manual-2.0.40-21
redhat-config-httpd-1.0.1-18
[root@yslx01 root]#
2.サービス状態の確認
[root@yslx01 root]# chkconfig --list|grep httpd
httpd 0:オフ 1:オフ 2:オフ 3:オフ 4:オフ 5:オフ 6:オフ
[root@yslx01 root]#
デフォルトインストールでも、サービスは起動されない状態に
なっている。
[root@yslx01 root]# ps -ef|grep httpd
root 11919 11875 0 13:02 pts/0 00:00:00 grep httpd
[root@yslx01 root]#
実際に稼働していない。
3.設定
/etc/httpd/conf/httpd.conf (これだけ)
とりあえず手っ取り早く起動させたいなら、以下の箇所を追加/修正
Listen 80
ServerName yslx01
4.サービスの起動
[root@yslx01 conf]# [[service]] httpd start
httpdを起動中: [ OK ]
[root@yslx01 conf]#
[root@yslx01 root]#
[root@yslx01 root]# ps -ef|grep httpd
root 11729 1 0 12:44 ? 00:00:00 /usr/sbin/
httpd
apache 11732 11729 0 12:44 ? 00:00:00 [httpd]
apache 11733 11729 0 12:44 ? 00:00:00 [httpd]
apache 11734 11729 0 12:44 ? 00:00:00 [httpd]
apache 11735 11729 0 12:44 ? 00:00:00 [httpd]
apache 11736 11729 0 12:44 ? 00:00:00 [httpd]
apache 11737 11729 0 12:44 ? 00:00:00 [httpd]
apache 11738 11729 0 12:44 ? 00:00:00 [httpd]
apache 11739 11729 0 12:44 ? 00:00:00 [httpd]
root 11903 11875 0 13:01 pts/0 00:00:00 grep httpd
[root@yslx01 root]#
補足
ちなみに、設定変更後にhttpdを起動させたときに
[root@yslx01 root]# service httpd start
httpdを起動中: httpd: Could not determine the server's
fully qualified
domain name, using 127.0.0.1 for ServerName
が、出力されたばあい、、、
以下の箇所を設定することで、解消される。(間違ってた)
/etc/httpd/conf/httpd.conf
# You will have to access it by its address anyway, and
this will make
# redirections work in a sensible way.
#
#ServerName new.host.name:80
ServerName yslx01:80
5.WEBブラウザでサイトに接続して確認
http://localhost/
=>「Test Page」のページが表示される。
/etc/httpd/conf/httpd.conf のデフォルトにおいて、
サイトのルートDir(ドキュメントルート)は、
DocumentRoot "/var/www/html"
となっている。
しかし、このDirには、上記のトップページのhtmlファイルは存在していない。
これは、index.htmlがドキュメントルートに存在しない場合は、
/var/www/error/noindex.htmlを表示する。
最終更新:2007年01月30日 22:39