Cloud Nine

Avatar

This blog is my everything!!

08/13
2008
VirtualHostの設定方法
8月 13, 2008 0

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.NameVirtualHost *:80の追加

NameVirtualHost *:80

3.httpd.conf にVirtualHostの設定を追加します。

<virtualhost *:80>
    DocumentRoot /home/text/www/ ドメインのRoot
    ServerName www.test.com 指定したいドメイン
</virtualhost>

4.apacheの再起動

Apacheの再起動方法はいろいろあります。

 /etc/rc.d/init.d/httpd restart
/usr/sbin/apachectl restart

上記の3つすれば、とりあずVirtualHostの設定は完了です。
http://httpd.apache.org/docs/2.2/ja/vhosts/examples.html

Tags:

,

関連記事

気に入った方はbookmarkしてください。


最近読んだお勧めの書籍 2009/08/17更新

No Comments, Comment or Ping

Reply to “VirtualHostの設定方法”

Search Keyword

Meta

face Ayumi Mizoshiri
シドニー在住
WEB developer

Linkedin

Wishlist

Facebook

twitter

mixi

Last fm

    follow me on Twitter

    ARCHIVES