Tips記事
» 2000年11月15日 00時00分 UPDATE

Apache(httpd)が起動できない

[木田佳克,ITmedia]

 Apacheを選択してインストールした場合,httpdの起動時にエラーになることがある。取りあえず起動させるためには,次の2点を確認しておく必要がある。

1. DNS(resolv.conf)の設定
 DNS(ネームサーバ)が設定されていないとhttpdの起動でエラーになってしまう。

 linuxconfであれば,「Networking」→「Client tasks」→「Name server specificaton (DNS)」にて「default domain」,「IP of name server」項目に設定しよう。

 直接エディタで編集する場合は,次の手順で行えばよい。設定内容は,自分のサーバ上でDNSが正式稼動していない場合,ISP側のドメイン名とIPアドレスを入力しておけばよい。

# vi /etc/resolv.conf
domain xxx.xxxx.ne.jp
nameserver 220.16.xxx.xx
nameserver 220.16.xxx.xx

2. ServerNameの設定(httpd.conf)

※次の例は,Red Hat Linux6.2の場合

# vi /etc/httpd/conf/httpd.conf
〜前略〜
# anyway, and this will make redirections work in a sensible way.
#
#ServerName localhost

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/home/httpd/html"

※「ServerName」項目のコメント「#」を取ってサーバ名を設定する。

#ServerName localhost
       ↓
ServerName hogehoge

※最後にApacheを起動してみる。
# /etc/rc.d/init.d/httpd start

 編集後は起動をしてみて「OK」と表示されれば稼動している。表示されるページのデータ(HTML)は,上記設定内の「DocumentRoot "/home/httpd/html"」だ。このディレクトリ下を編集すれば自由なページにすることができる。

Copyright © ITmedia, Inc. All Rights Reserved.

注目のテーマ