13
- VirtualHostの設定方法
- Aug 13, 2008
VirtualHostの設定方法を紹介します。
VirtualHostを設定すると、複数のドメインを一台サーバで運営することができます。
httpd.conf の設定
Apacheのhttpd.confを変更します。
デフォルトなら、/etc/httpd/conf/httpd.conf あたりにいます。
みつからない時は、
locate httpd.conf
で探してください。
1.ServerNameのコメントアウト
# If your host doesn't have a registered DNS name, enter its IP address here. # You will have to access it by its address anyway, and this will make # redirections work in a sensible way. # #ServerName localhost コメントアウトしてください。
2.httpd.conf にVirtualHostの設定を追加します。
<virtualhost *:80>
DocumentRoot /home/text/www/ ドメインのRoot
ServerName www.test.com 指定したいドメイン
</virtualhost>
3.apacheの再起動
Apacheの再起動方法はいろいろあります。
/etc/rc.d/init.d/httpd restart
/usr/sbin/apachectl restart
上記の3つすれば、とりあずVirtualHostの設定は完了です。





No Comments, Comment or Ping
Reply to “VirtualHostの設定方法”