# Apache doesn't show pages without errors



## Const (Jul 14, 2009)

Hello. I've got a problem trying to set up Apache 2.2_11 on my FreeBSD 7.2 box. I've installed it via "pkg_add -r apache" command and set up to listen port 8080 in httpd.conf. After apache starting I see it in processes list but don't get anything when trying to access it via browser or telnet. Browser just hangs up in loading state (like waiting for web-server answer) and telnet command "get /" shows me nothing

There are IPFW, kernel NAT and Squid services are running on this machine. I've set up rules for ipfw to accept packets coming to 8080 port from anyone and to pass outgoing packets from server to anyone. In /var/log/security I see these rules work every time I'm trying to get the page from server

I've also tried to disable firewall and squid. httpd-access.log file is empty (Apache doesn't get any requests?), httpd-error.log contains only information about starting (no errors). Can anyone give me a hint about this problem? Apache worked perfect on other FreeBSD box (without firewall and squid installed)


----------



## roddierod (Jul 14, 2009)

On that machine, if you use http://localhost:8080 do hit the website.


----------



## Const (Jul 14, 2009)

Well... I can't check it because of no X on the server. But since telnet returns me nothing I think that won't show me anything


----------



## roddierod (Jul 14, 2009)

You could use lynx (no X based browser).


----------



## vivek (Jul 14, 2009)

Is port open?

```
sockstat -4 -p 8080 -l
```

Can you telnet to port 8080 from box itself?

```
telnet localhost 8080
```
or from remote windows / unix workstatin?

```
telnet your-server.ip 8080
```

Try disabling squid, firewall and httpd and see if you can run telnet again?


----------



## Const (Jul 14, 2009)

I think the port is opened

```
proxy# sockstat -4 -p 8080 -l
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS
root     httpd      27395 3  tcp46  *:8080                *:*
```
I can telnet it both from localhost and remote machine but using "get /" command (that should return me standard "It works!" Apache page) gives me no output

```
proxy# telnet localhost 8080
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
get /
^]
telnet> quit
Connection closed.
```
Here is an output from httpd-error.log (I guess it's usual starting)

```
[Tue Jul 14 22:03:33 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Tue Jul 14 22:03:34 2009] [notice] Digest: generating secret for digest authentication ...
[Tue Jul 14 22:03:34 2009] [notice] Digest: done
[Tue Jul 14 22:03:34 2009] [notice] Apache/2.2.11 (FreeBSD) mod_ssl/2.2.11 OpenSSL/0.9.8e DAV/2 configured -- resuming normal operations
```
And I see httpd process running

```
proxy# ps ax |grep httpd
27395  ??  Ss     0:00.07 /usr/local/sbin/httpd -k start
27408  p0  D+     0:00.00 grep httpd
```
I've disabled IPFW and Squid

```
proxy# ipfw disable firewall

proxy# squid -k shutdown

proxy# ps ax |grep squid
27434  p0  D+     0:00.00 grep squid
```
but the situation hasn't changed. Also my httpd-access.log file is empty - does it mean apache hasn't got any requests?


----------



## roddierod (Jul 14, 2009)

Did you modify the httpd.conf to listen on 8080, I think the default it to only listen on 80.


----------



## Const (Jul 14, 2009)

Yes, it was modified

```
Listen 8080
ServerName 192.168.1.2:8080
```
The rest of config is default


----------



## anomie (Jul 14, 2009)

@Const: the httpd service is listening on tcp 8080, and you're able to connect to it on localhost. So far so good...

What happens if you run the following scan from another host on the same network: 
`% nc -zvw 1 192.168.1.2 8080`

If it times out you've possibly got a firewall (or NAT) issue.


----------



## Const (Jul 14, 2009)

Well... the problem is I can't connect to it even on localhost. Looks like it listens on 8080 but hangs on trying to return index.html. I've checked the path to this file and access rights for user "www" on it but still nothing

Lynx hangs with "HTTP request sent; waiting for response." message. Same as browser from remote machine


----------



## Const (Jul 15, 2009)

I have noticed the difference in apache behaviour on my test (no squid and ipfw) and work machines. On test:

```
# ps ax | grep httpd
  901  ??  Ss     0:00.10 /usr/local/sbin/httpd -k start
  902  ??  I      0:00.00 /usr/local/sbin/httpd -k start
  903  ??  I      0:00.00 /usr/local/sbin/httpd -k start
  904  ??  I      0:00.00 /usr/local/sbin/httpd -k start
  905  ??  I      0:00.00 /usr/local/sbin/httpd -k start
  906  ??  I      0:00.00 /usr/local/sbin/httpd -k start
  952  p0  D+     0:00.00 grep httpd
```
I have few httpd processes and on work only one:

```
proxy# ps ax |grep httpd
 2362  ??  Ss     0:00.23 /usr/local/sbin/httpd -k start
 3968  p0  D+     0:00.00 grep httpd
```
Can it cause the problem?

EDITED: I've added

```
<IfModule prefork.c>
    MinSpareServers 5
    MaxSpareServers 10
    StartServers 10
    MaxClients 150
    MaxRequestsPerChild 0
</IfModule>
```
to my httpd.conf file. On Test machine I've got 10 child httpd processes when Apache started. On Work machine there are no new processes, still only one. What can stop Apache from creating child processes?

ADDED: Looks like finally I've found it out  Apache was set from packages and had default configuration as

```
Server MPM:     Peruser
```
And on my Test box it was set up also via packages but that option was

```
Server MPM:     Prefork
```
I still don't know why it was installed like that and don't know why Peruser didn't work. I've reinstalled Apache from ports and it's set up with Prefork option. Now it works  Thanks to everyone for the help. Supporting helps to keep moving and trying to resolve the problem


----------



## rg25 (Jul 16, 2009)

*Can not bring up a page [MERGED]*

I have installed using pkg_add apache22.  Added it to /etc/rc.conf to start automatically.  Starts find no problems.  Under the document root, data directory, there is single index.html file.  I am not able to pull it.  I am at a loss here.  I have attached httpd.conf file.


Below is error log


```
[Wed Jul 15 23:01:08 2009] [notice] caught SIGTERM, shutting down
[Wed Jul 15 23:02:25 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Wed Jul 15 23:02:26 2009] [notice] Digest: generating secret for digest authentication ...
[Wed Jul 15 23:02:26 2009] [notice] Digest: done
[Wed Jul 15 23:02:26 2009] [notice] Apache/2.2.11 (FreeBSD) mod_ssl/2.2.11 OpenSSL/0.9.8e DAV/2 configured -- resuming normal operations
[Wed Jul 15 23:17:19 2009] [notice] SIGHUP received.  Attempting to restart
[Wed Jul 15 23:17:20 2009] [notice] Digest: generating secret for digest authentication ...
[Wed Jul 15 23:17:20 2009] [notice] Digest: done
[Wed Jul 15 23:17:20 2009] [notice] Apache/2.2.11 (FreeBSD) mod_ssl/2.2.11 OpenSSL/0.9.8e DAV/2 configured -- resuming normal operations
[root@dspam /usr/local/www/apache22/data]#
```


Any help is appreciated.

Thanks in advance


----------



## Const (Jul 16, 2009)

Looks like the problem similiar to mine 

http://forums.freebsd.org/showthread.php?t=5517


----------



## rg25 (Jul 16, 2009)

Thanks, that worked for me.


----------

