Apache2 Ubuntu 12.10只识别默认虚拟主机

Apache2 Ubuntu 12.10只识别默认虚拟主机,apache2,virtualhost,ubuntu-10.10,Apache2,Virtualhost,Ubuntu 10.10,我以前在使用其他版本的Linux时遇到过这个问题,通常这是一个愚蠢的问题,但我想我已经排除了所有这些可能性。我在apache2 Ubuntu 12.10上使用多个虚拟主机。根据Ubuntu默认设置: [ports.conf] NameVirtualHost *:80 Listen 80 <IfModule mod_ssl.c> # If you add NameVirtualHost *:443 here, you will also have to change

我以前在使用其他版本的Linux时遇到过这个问题,通常这是一个愚蠢的问题,但我想我已经排除了所有这些可能性。我在apache2 Ubuntu 12.10上使用多个虚拟主机。根据Ubuntu默认设置:

[ports.conf]

NameVirtualHost *:80
Listen 80

<IfModule mod_ssl.c>
    # If you add NameVirtualHost *:443 here, you will also have to change
    # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
    # to <VirtualHost *:443>
    # Server Name Indication for SSL named virtual hosts is currently not
    # supported by MSIE on Windows XP.
    Listen 443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>

Apache2.conf is ubuntu default and loads ports.conf.

I have two virtualhosts
<VirtualHost *:80>

 ServerName *.staging.mydomain.com

 Options -Indexes FollowSymLinks

 UseCanonicalName Off
 DocumentRoot /var/www/staging/app/application/current/app

 ErrorLog "/var/log/error.log"
 CustomLog "/var/log/custom_error.log" common

 <ifModule env_module>
  SetEnv PHP_ENV staging
 </ifModule>
 <Directory />
  AllowOverride none
 </Directory>

 <Directory "/var/www/staging/app/application/current/app">
  RewriteEngine On

  RewriteBase /

  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

 </Directory>

</VirtualHost>
<VirtualHost *:80>

 ServerName *.devtest.mydomain.com

 Options -Indexes FollowSymLinks

 UseCanonicalName Off
 DocumentRoot /var/www/devtest/app/application/current/app

 ErrorLog "/var/log/error.log"
 CustomLog "/var/log/custom_error.log" common

 <ifModule env_module>
  SetEnv PHP_ENV develop
 </ifModule>
 <Directory />
  AllowOverride none
 </Directory>

 <Directory "/var/www/devtest/app/application/current/app">
  RewriteEngine On

  RewriteBase /

  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

 </Directory>

</VirtualHost>
最后,请求在服务器
curl-Lv上解析http://test.staging.mydomain.com

* About to connect() to test.staging.mydomain.com port 80 (#0)
*   Trying 1.1.1.1...
* connected
* Connected to test.staging.mydomain.com (1.1.1.1) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.27.0
> Host: test.staging.mydomain.com
> Accept: */*
>
* additional stuff not fine transfer.c:1037: 0 0
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 200 OK
< Date: Tue, 05 Mar 2013 02:22:28 GMT
< Server: Apache/2.2.22 (Ubuntu)
< X-Powered-By: PHP/5.4.6-1ubuntu1.1
< Vary: Accept-Encoding
< Content-Length: 18
< Content-Type: text/html
<
* Connection #0 to host test.staging.mydomainy.com left intact
<pre>staging</pre>* Closing connection #0
*即将()连接到test.staging.mydomain.com端口80(#0)
*正在尝试1.1.1.1。。。
*连接的
*已连接到test.staging.mydomain.com(1.1.1.1)端口80(#0)
>GET/HTTP/1.1
>用户代理:curl/7.27.0
>主机:test.staging.mydomain.com
>接受:*/*
>
*附加材料未精细转移。c:1037:0
*HTTP 1.1或更高版本,支持持久连接和流水线
我已经删除了IP和域,但它肯定能正确解析。服务器上的一切都运行良好,事实上,我甚至没有注意到这个问题,直到我在登台环境中并注意到数据在devtest域上更新,而不是登台


我通常不会在这里寻求任何帮助,我已经搜索了web和堆栈溢出。对于不正确的端口名、未在VirtualHosts中声明ServerName、未声明名称VirtualHost*:80或侦听正确的端口,这似乎不是问题。我完全被难住了。同样的配置也适用于基于RPM的Linux版本。

我想我只是需要休息一下。这不起作用,因为我为服务器名指定了通配符。虚拟主机应该分别是
ServerName staging.mydomain.com
ServerAlias*.staging.mydomain.com
ServerName devtest.mydomain.com
ServerAlias*.devtest.mydomain.com
。希望这能为其他人节省一些时间。
* About to connect() to test.staging.mydomain.com port 80 (#0)
*   Trying 1.1.1.1...
* connected
* Connected to test.staging.mydomain.com (1.1.1.1) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.27.0
> Host: test.staging.mydomain.com
> Accept: */*
>
* additional stuff not fine transfer.c:1037: 0 0
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 200 OK
< Date: Tue, 05 Mar 2013 02:22:28 GMT
< Server: Apache/2.2.22 (Ubuntu)
< X-Powered-By: PHP/5.4.6-1ubuntu1.1
< Vary: Accept-Encoding
< Content-Length: 18
< Content-Type: text/html
<
* Connection #0 to host test.staging.mydomainy.com left intact
<pre>staging</pre>* Closing connection #0