我坚持配置 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
在第二台机器上这不起作用,两个 URLS 最终都指向第一个应用程序,它的输出相同的命令有额外的:行:
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
每台机器的虚拟主机文件是损坏的:
<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