はじめての自宅サーバ構築 - Fedora/CentOS -
Last Update 2018/05/30
[ 更新履歴 ] [ サイト マップ ] [ 質問掲示板 ] [ 雑談掲示板 ] [ リンク ]
トップ >> 質問掲示板

 バーチャルホストの重複
日時: 2008/02/27 08:59
名前: ばーちぇ

 [warn] _default_ VirtualHost overlap on port 80, the first has precedence

バーチャルホストの設定をしたとき、上記のようなエラーが出てきます。
apacheを再起動した際にこのように出ました。
原因はポートが重複しているそうなのですが、どのように対処すればよいのかわかりません。
OSはCentOS 5.1です。よろしくお願いします。
メンテ

Page:  [1] [2]

■ コンテンツ関連情報

 Re: バーチャルホストの重複 ( No.1 )
日時: 2008/02/27 09:09
名前: バーチェ

BIND等はやっておりません。
もしかしてapacheの下記の部分を変更する必要があるのでしょうか?
apache解説ページの引用したものですみません。

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
※:以下<VirtualHost xxx>〜</VirtualHost>ディレクティブ(xxx:nn)
 xxx:IPアドレス
 nn :ポート
特定のホスト名や IP アドレスのみに適用されるディレクティブを囲む
サーバが、指定されたバーチャルホストにあるドキュメントへの リクエストを受け付けた場合、
<VirtualHost> セクションの中にある ディレクティブが適用されます
#<VirtualHost *:80>
#  ServerAdmin webmaster@dummy-host.example.com
#  DocumentRoot /www/docs/dummy-host.example.com
#  ServerName dummy-host.example.com
#  ErrorLog logs/dummy-host.example.com-error_log
#  CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

〜 Sample 〜 「複数のドメインでアクセスを受けるようにするには?」
NameVirtualHostにWAN側IPアドレスを指定
NameVirtualHost xxx.xxx.xxx.xxx
abcdeドメイン側の設定
<VirtualHost xxx.xxx.xxx.xxx>
ServerName www.abcde.co.jp
ServerAdmin webmaster@abcde.co.jp
DocumentRoot /var/www/abcde
</VirtualHost>
vwxyzドメイン側の設定
<VirtualHost xxx.xxx.xxx.xxx>
ServerName www.vwxyz.co.jp
ServerAdmin webmaster@vwxyz.co.jp
DocumentRoot /var/www/vwxyz
</VirtualHost>
メンテ
 Re: バーチャルホストの重複 ( No.2 )
日時: 2008/02/27 09:14
名前: 管理者

バーチャルホスト設定に「NameVirtualHost」ディレクティブは以下の様になっていますか?

NameVirtualHost *:80
メンテ
 Re: バーチャルホストの重複 ( No.3 )
日時: 2008/02/27 09:22
名前: ばーちぇ

迅速な対応ありがとうございます。
現状では何も書いていなかったため下記の通りでした。

#NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier 
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *:80>
#  ServerAdmin webmaster@dummy-host.example.com
#  DocumentRoot /www/docs/dummy-host.example.com
#  ServerName dummy-host.example.com
#  ErrorLog logs/dummy-host.example.com-error_log
#  CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

これにNameVirtualHost *:80を追加して


#NameVirtualHost *:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier 
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#

NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *:80>
#  ServerAdmin webmaster@dummy-host.example.com
#  DocumentRoot /www/docs/dummy-host.example.com
#  ServerName dummy-host.example.com
#  ErrorLog logs/dummy-host.example.com-error_log
#  CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>


このようにすればよろしいのでしょうか・・?
よろしくお願い致します。
メンテ
 Re: バーチャルホストの重複 ( No.4 )
日時: 2008/02/27 09:35
名前: 管理者

そうですね。
サンプルなので各バーチャル定義がどの様になっているか不明ですが、当サイトでも紹介しているので以下を参考なさってみてください。

『バーチャルホストの公開方法 : http://kajuhome.com/tips/tips_03_004.shtml
メンテ
 Re: バーチャルホストの重複 ( No.5 )
日時: 2008/02/27 09:57
名前: ばーちぇ

NameVirtualHost 192.168.24.81
<VirtualHost 192.168.24.81>
ServerName main.com
ServerAdmin webmaster@main.com
DocumentRoot /var/www/html
</VirtualHost>

<VirtualHost 192.168.24.81>
ServerName sub.com
ServerAdmin webmaster@su.com
DocumentRoot /var/www/html/sub
</VirtualHost>

このように追記し、


<VirtualHost *:80>
  ServerName main.com
</VirtualHost>

<VirtualHost *:80>
  ServerName sub.com
  DocumentRoot /var/www/html/sub.com
  ErrorLog logs/virtual-error_log
  CustomLog logs/virtual-access_log combined env=!no_log
</VirtualHost>

このように設定しております。
このようにしたら、内部からのアクセスはできたのですが、外部からのアクセスはできないままでした。
また、ポートのエラーもでたままです。
何度もすみません、どうか他に問題の箇所を指摘してもらえないでしょうか・・・
apacheの必要最低限の設定のみをこのサイトを参考にさせていただき、バーチャル定義はこれ以外ではしtないつもりです。
どうかよろしくお願いします。
メンテ

Page:  [1] [2]

題名
名前  ("初心者"を含む名前は使用できません)
E-Mail
URL
パスワード 記事メンテ時に使用)
投稿キー (投稿時 投稿キー を入力してください)
コメント
画像添付 (対応画像:JPEG/GIF/PNG [Max 500KB])

   クッキー保存

■ その他


Copyright(©)2004-2018 First home server construction. All Right Reserved.