*Apache2のインストール
#contents

**パッケージのインストール
-apache2
 # aptitude install apache2
-PHP5もインストール
 # aptitude install php5
-perlのモジュールもインストール
 # aptitude install libapache2-mod-perl2
 # aptitude install perl-suid

**Apace2の設定ファイル
|/etc/apache2/apache2.conf|apache2の全体設定用ファイル|
|/etc/apache2/ports.conf|ポート番号|
|/etc/apache2/mods-available/|モジュールファイルが置かれるディレクトリ|
|/etc/apache2/mods-enabled/|使用するモジュールへのリンクファイルが置かれるディレクトリ|
|/etc/apache2/sites-available/|サイト定義ファイルが置かれるディレクトリ|
|/etc/apache2/sites-enabled/|使用するサイト定義ファイルへのリンクファイルが置かれるディレクトリ|
サイト定義ファイルをsites-available/で作成し、その定義を有効にするにはsites-enabled/内にリンクを作成すればよい。モジュールに関しても同様。これらを行うコマンドが用意されている。
-シンボリックリンクを張る。対象モジュールやサイトが有効になる。
 a2enmod モジュールファイル名
 a2ensite サイト設定ファイル名
-シンボリックリンクの削除。対象モジュールやサイトが無効になる。
 a2dismod モジュールファイル名
 a2dissite サイト設定ファイル名
-標準的なサイト設定
--編集ファイル:/etc/apache2/sites-available/default
<pre>
NameVirtualHost *
<VirtualHost *>
        ServerName &color(red){www.XXXXX.jp};
        ServerAdmin &color(red){postmaster&#x40;XXXXX.jp};

        DocumentRoot &color(red){/var/www/htdocs}; &color(green){# ディレクトリhtdocsの作成};
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory &color(red){/var/www/htdocs};>
                Options FollowSymLinks MultiViews  &color(green){# Indexesの削除};
                AllowOverride None
                Order allow,deny
                allow from all
                # This directive allows us to have apache2's default start page
                # in /apache2-default/, but still have / go to the right place
&color(red){#};                RedirectMatch ^/$ /apache2-default/  &color(green){# リダイレクトをさせない};
        </Directory>

        ScriptAlias /cgi-bin/ &color(red){/var/www/cgi-bin/};  &color(green){# 新規に作成};
        <Directory "/var/www/cgi-bin">
                AllowOverride None
                Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog /var/log/apache2/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/access.log combined
        ServerSignature On

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>
</pre>
-起動、終了時にワーニングが発生
 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
解決方法
サイト設定ファイルdefaultの中でServerNameのサーバ名を''/etc/hosts''に追加する。
<pre>
127.0.0.1 &color(red){www.XXXXX.jp}; localhost kaeru
</pre>
※ 先頭に記述しないとダメ。


トップ   差分 履歴 リロード   一覧 検索 最終更新   ヘルプ   最終更新のRSS