バーチャルホストを試してみる†
サブドメインによるアクセス切り替え†
- /etc/httpd/conf.d/virtualhost-sea-bird.org.conf と、ファイルを作成します。
#
# Use name-based virtual hosting.
#
<VirtualHost *:80> ← 1.
ServerAdmin hoge@sea-bird.org
DocumentRoot "/var/www/html"
ServerName www.sea-bird.org
ErrorLog logs/error_log
CustomLog logs/access_log combined
</VirtualHost>
<VirtualHost *:80> ← 2.
ServerAdmin hoge@sea-bird.org
DocumentRoot "/var/www/html/blog"
ServerName blog.sea-bird.org
ErrorLog logs/error_log
CustomLog logs/access_log combined
</VirtualHost>
<VirtualHost *:80> ← 3.
ServerAdmin hoge@sea-bird.org
DocumentRoot "/var/www/html/hoge"
ServerName test.sea-bird.org
ErrorLog logs/error_log
CustomLog logs/access_log combined
</VirtualHost>
- サーバを再起動します
# /etc/init.d/httpd restart
# httpd -S
マルチドメイン対応†
- mcbc-net.net ドメインも所有しているので同じサーバでルチドメイン対応をしてみる。といっても、ServerName に ドメインを記述するだけでok
参考にさせて頂いたサイト様†
Last-modified: 2020-03-12 (木) 09:59:18