LoginSignup
9
10

More than 5 years have passed since last update.

ec2でバーチャルホストの設定をした

Last updated at Posted at 2012-05-23

■準備
elastic ipの取得
お名前.comでのDNS取得(他サービスを使う場合は読み替え)
バーチャルホストするドメイン全てにAレコード追加(elastic ipを指定)

/etc/httpd/conf/httpd.conf
#コメント解除
NameVirtualHost *:80

# 元ドメイン用追記
<VirtualHost *:80>
   DocumentRoot /var/www/html
   ServerName お名前.comドメイン1
</VirtualHost>
# 追加ドメイン用追記
<VirtualHost *:80>
   DocumentRoot /var/www/virtual
   ServerName お名前.comドメイン2
</VirtualHost>

設定するなら下記も追加
ServerAdmin
ErrorLog logs
CustomLog logs

■注意点
・バーチャルホスト設定時はcode欄の様に元ドメインも定義する
・/etc/init.d/httpd restartして設定を反映

参考になったHP
http://d.hatena.ne.jp/ichhi/20110425/1303739017

9
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
10