WWW サーバの構築 - Apache


  1. Apache

    Solaris の Web Server というと Sun Web Server が思い浮かびますが、Solaris 8 では Apache が標準で実装されていますのでこれを利用します。

  2. パッケージの確認

    パッケージがインストールされているか確認します。

    casper% pkginfo | grep -i apache
    system SUNWapchd Apache Web Server Documentation
    system SUNWapchr Apache Web Server (root)
    system SUNWapchu Apache Web Server (usr)
    casper%

  3. ソースのパッケージの追加

    必要な場合はソースパッケージを追加できます (でも大抵の場合必要ないです)。

    # pwd
    /export/s8/Solaris_8/Product
    # pkgadd -d . SUNWapchS

    pkg のベースディレクトリは / ですがファイルは /usr/share/src/apache 下に展開されます。

  4. httpd.conf の設定

    /etc/apache/httpd.conf-example を httpd.conf としてコピーします。

    # pwd
    /etc/apache
    # cp httpd.conf-example httpd.conf
    # chown root:bin httpd.conf
    #

    ヴァージョンの古い Apache では、httpd.conf, srm.conf, access.conf の3つの設定ファイルが順番に読み込まれ起動しますが、Solaris 8 標準実装の Apache では httpd.conf にのこり2つのファイルの内容を全て記述します。
    今回は以下の設定を変更してみました。

    table1
    item value note
    ServerAdmin webmaster@personal.or.jp サーバ管理者のメールアドレスです。
    ServerName www.personal.or.jp httpd サーバ名です。
    DirectoryIndex index.html index.htm ディレクトリ指定のファイル名を追加しています。

    webmaster エイリアスは標準では設定されていませんので、/etc/aliases に以下を追加して、/usr/bin/newaliases を実行します。

    webmaster: root

  5. Apache の起動

    以下の方法で Apache を起動できます。

    # pwd
    /usr/apache/bin
    # ./apachectl start
    ./apachectl start: httpd started
    #

    あるいは、

    # /etc/init.d/apache start
    httpd starting.

  6. Apache の自動起動

    /etc/apache/httpd.conf が作成されていると /etc/rc3.d/S50apache によってシステム起動時に apache が自動起動されます。

  7. docs directory

    デフォルトでは /var/apache/htdocs 下が web server の root に設定されています (DocumentRoot item in httpd.conf)。path を変更する場合は、httpd.conf ファイルを編集するか、目的のディレクトリに /var/apache/htdocs をシンボリックリンクします。


もどる Last modified: 04/09/01 00:40:53