0

次の名前ベースの仮想ホストで2つの異なるサイトを提供するようにapacheを構成することに行き詰まっています。

http://experimental/

http://api.experimental/

あるマシンでは、このセットアップは正常に機能し、apache は次のように報告します。

apachectl -D DUMP_VHOSTS
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:*                    is a NameVirtualHost
         default server experimental (/etc/apache2/sites-enabled/00-nowa.conf:3)
         port * namevhost experimental (/etc/apache2/sites-enabled/00-nowa.conf:3)
         port * namevhost api.experimental (/etc/apache2/sites-enabled/00-nowa.conf:15)
Syntax OK

2 番目のマシンでは、これは機能しません。両方の URL が最初のアプリを指すことになります。同じコマンドの出力には、追加の:行があります。

apachectl -D DUMP_VHOSTS
apache2: apr_sockaddr_info_get() failed for experimental
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[Tue May 14 15:36:08 2013] [warn] NameVirtualHost *:80 has no VirtualHosts
[Tue May 14 15:36:08 2013] [warn] NameVirtualHost *:80 has no VirtualHosts
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:*                    experimental (/etc/apache2/sites-enabled/00-nowa.conf:3)
*:*                    api.experimental (/etc/apache2/sites-enabled/00-nowa.conf:15)
Syntax OK

各マシンの vhost ファイルは、壊れたものの次のとおりです。

<VirtualHost *>
  ServerName experimental

  RailsEnv production
  DocumentRoot /home/nowa/nowa_app/nowa/current/public

  <Directory /home/nowa/nowa_app/nowa/current/public >
     Allow from all
     Options -MultiViews
  </Directory>
</VirtualHost>

<VirtualHost *>
  ServerName api.experimental

  RackEnv production

  PassengerMinInstances 2
  PassengerMaxPoolSize 10

  DocumentRoot /home/nowa/nowa_app/services/api_gateway/current/app
</VirtualHost>

そして働く

<VirtualHost *>
    ServerName experimental
    RailsEnv production
    DocumentRoot /home/nowa/nowa_app/nowa/current/public
      <Directory /home/nowa/nowa_app/nowa/current/public >
         Allow from all
         Options -MultiViews
      </Directory>
</VirtualHost>

<VirtualHost *>
    ServerName api.experimental

    RackEnv production

    PassengerMinInstances 2
    PassengerMaxPoolSize 10


    DocumentRoot /home/nowa/nowa_app/services/nowa_api_gateway/current/app
</VirtualHost>

apachectl -D DUMP_VHOSTS の出力が異なるのはなぜですか? 私は何を逃したのですか?:C

4

1 に答える 1

2

#httpd IRC ルームで質問したところ、apache が誤解していたことが判明

<VirtualHost *> 

名前ベースではなく、IPベースのvhostエントリとして、これに変更すると修正されました:

<VirtualHost *:80>

これは、壊れたサーバーで NameVirtualHost が次のように定義されていたためです。

NameVirtualHost *:80

完全な作業構成:

<VirtualHost *:80>
  ServerName experimental

  RailsEnv production
  DocumentRoot /home/nowa/nowa_app/nowa/current/public

  <Directory /home/nowa/nowa_app/nowa/current/public >
     Allow from all
     Options -MultiViews
  </Directory>
</VirtualHost>

<VirtualHost *:80>
  ServerName api.experimental

  RackEnv production

  PassengerMinInstances 2
  PassengerMaxPoolSize 10

  DocumentRoot /home/nowa/nowa_app/services/api_gateway/current/app
</VirtualHost>
于 2013-05-15T08:37:17.887 に答える