apache2 virtual hostの設定方法
手順概要:
1. /etc/apache2/sites-available へファイルを追加
2. /etc/apache2/sites-enabled にsymlinkを追加
3. /etc/hosts に新サイトに関する情報を追加
4. apacheの再起動
1. /etc/apache2/sites-available へファイルを追加
このディレクトリに行き、新しくファイルを作る。ファイル名は新しいサイトのもの
sudo vi test.lh
ServerAdmin me@localhost
ServerAlias example.lh
DocumentRoot /usr/local/drupal5
#we want specific log file for this server
CustomLog /var/log/apache2/example.lh.log combined
Options FollowSymLinks
AllowOverride None
#enable symlink
Options Indexes FollowSymLinks MultiViews
AllowOverride All
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
2. /etc/apache2/sites-enabled にsymlinkを追加
cd /etc/apache2/sites-enabled
sudo ln -s /etc/apache2/sites-available/example.lh
3. /etc/hosts に新サイトに関する情報を追加
4. apacheの再起動
sudo /etc/init.d/apache2 restart