<div class="gmail_quote">On Tue, Aug 10, 2010 at 4:19 PM, Chanoch (Ken) Bloom <span dir="ltr"><<a href="mailto:kbloom@gmail.com" target="_blank">kbloom@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div></div><div>On Tue, Aug 10, 2010 at 03:50:00PM -0400, Peter Salzman wrote:<br>
> I set up Apache2 on home Kubuntu box. I defined one named virtual host in<br>
> addition to "default" that came with the installation. When I try to access<br>
> the server from work, Firefox responds with "The connection timed out".<br>
><br>
> When I run tcpdump -i eth0 tcp port 80, I see the incoming request from work<br>
> to <a href="http://www.dirac.org" target="_blank">http://www.dirac.org</a>:<br>
><br>
> 14:30:42.219003 IP ny-131.foo.com.33188 > satan.www: Flags [S], seq<br>
> 3646786876, win 64512, options [mss 1460,nop,nop,sackOK], length 0<br>
><br>
> I also see (what looks to be) the outgoing packets from satan to work:<br>
><br>
> 14:30:42.219027 IP satan.www > ny-131.foo.com.33188: Flags [S.], seq<br>
> 2741002130, ack 3646786877, win 5840, options [mss 1460,nop,nop,sackOK],<br>
> length 0<br>
><br>
> However, *nothing* is getting written to the logs:<br>
><br>
> -rw-r----- 1 root root 0 2010-08-10 12:21 access.log<br>
> -rw-r----- 1 root root 0 2010-08-10 12:21 dirac.org.access<br>
> -rw-r----- 1 root root 0 2010-08-10 12:21 dirac.org.error<br>
> -rw-r----- 1 root root 330 2010-08-10 12:21 error.log<br>
><br>
><br>
> The file error.log doesn't have anything interesting in it:<br>
><br>
><br>
> [Tue Aug 10 12:21:00 2010] [notice] Apache/2.2.12 (Ubuntu)<br>
> PHP/5.2.10-2ubuntu6.4 with Suhosin-Patch mod_perl/2.0.4 Perl/v5.10.0<br>
> configured -- resuming normal operations<br>
> [Tue Aug 10 12:21:00 2010] [info] Server built: Mar 9 2010 21:20:44<br>
> [Tue Aug 10 12:21:00 2010] [debug] prefork.c(1013): AcceptMutex: sysvsem<br>
> (default: sysvsem)<br>
><br>
><br>
> From the lack of entries in the log file, it looks like Apache isn't seeing<br>
> the incoming request. However, tcpdump seems to be showing otherwise. Port<br>
> 80 is forwarded to the Linux box by the router.<br>
<br>
</div></div>First, we *need* to know the names of the files involved, since the<br>
alphabetical order of the files determines which is the default host<br>
(the first host is default, so you should have<br>
sites-enabled/000-default and sites-enabled/001-dirac).<br>
<br>
> In sites.enabled:<br>
<br>
Did you verify that this is the correct IP address? (You probably want<br>
to use "*:80" instead.)<br>
<div><br>
> <VirtualHost <a href="http://24.189.162.69:80" target="_blank">24.189.162.69:80</a>><br>
> ServerAdmin <a href="mailto:p@dirac.org" target="_blank">p@dirac.org</a><br>
> ServerName <a href="http://www.dirac.org" target="_blank">www.dirac.org</a><br>
> ServerAlias <a href="http://dirac.org" target="_blank">dirac.org</a><br>
><br>
> # Indexes + Directory Root.<br>
> DirectoryIndex index.html<br>
> DocumentRoot /var/www/<br>
><br>
> # Logfiles<br>
> ErrorLog /var/log/apache2/dirac.org.error<br>
> CustomLog //var/log/apache2/dirac.org.access combined<br>
> </VirtualHost><br>
><br>
> The default enabled site starts off as:<br>
<br>
</div>You don't have a ServerName for the default site. Is it<br>
possible that the default is catching all of the requests since it has<br>
no name? Give it a name. Since it's the default (its configuration<br>
file comes first alphabetically), it will still respond<br>
to any unknown hostnames passed in the host header.<br>
<br>
The link I quote below says:<br>
"ServerName should always be set for each vhost. Otherwise A DNS lookup<br>
is required for each vhost."<br>
<div><br>
> <VirtualHost <a href="http://24.189.162.69:80" target="_blank">24.189.162.69:80</a>><br>
> ServerAdmin <a href="mailto:p@dirac.org" target="_blank">p@dirac.org</a><br>
> DocumentRoot /var/www<br>
> . . .<br>
> </VirtualHost><br>
><br>
><br>
> Any ideas what could be preventing this from working?<br>
<br>
</div>For more information about Apache virtual host ordering, see<br>
<a href="http://httpd.apache.org/docs/2.2/vhosts/details.html" target="_blank">http://httpd.apache.org/docs/2.2/vhosts/details.html</a><br>
<br>
--Ken<br></blockquote><div><br>Interesting -- I didn't know that the sites were read in alpha order. Also, I guess the wildcard for the NameVirtualHost is a better idea.<br><br>Unfortunately, didn't fix the problem, but more weirdness came up. I can't telnet to <a href="http://dirac.org">dirac.org</a> port 80, which would explain why the logs aren't being touched. But then I'm at a loss as to how tcpdump apparently sees the connection:<br>
<br> tcpdump -i eth0 tcp port 80<br><br>16:40:32.104293 IP ny-131.foo.com.10096 > satan.www: Flags [S], seq 1653467397, win 64512, options [mss 1460,nop,nop,sackOK], length 0<br><br>16:40:32.104314 IP satan.www > ny-131.foo.com.10096: Flags [S.], seq 329481650, ack 1653467398, win 5840, options [mss 1460,nop,nop,sackOK], length 0<br>
<br>It looks like the packets are getting forwarded correctly, but nobody is listening. The port is set correctly in /etc/apache2/ports.conf and I verified that apache2 is indeed running. It's such a mystery! :-(<br>
<br>Pete<br></div></div>