# Apache2 Problems

## gluc0se

Ok, well, I have used emerge apache mod_php a few times now...

The first time it worked ok, but then for some reason started telling me "Cannot connect to remote server" when I tried 'lynx localhost'

So, I did emerge apache mod_php again, and it worked. But then the internet couldn't see it..So someone on #gentoo-server suggested changing ipv6 to -ipv6 in USE="" and emerging again.

So I did that, and now:

"Cannot connect to remote server"

I'm not really sure where to go from here, so all help will be appreciated  :Smile: 

----------

## lamekain

sorry if this sounds a bit stupid, but did you start the server with the /etc/init.d/apache2 start script?   :Smile: 

I just got my apache2 running with php, and didn't run into that error..

----------

## gluc0se

Ya I did  :Smile: 

I wish it was something that simple, lol..It probably is..But no, it definetly isn't that.

----------

## gluc0se

Anymore suggestions? :-p

----------

## lamekain

I'm running out of ideas already.. Are you sure you are trying to connect to localhost? 

 *Quote:*   

> So, I did emerge apache mod_php again, and it worked. But then the internet couldn't see it..So someone on #gentoo-server suggested changing ipv6 to -ipv6 in USE="" and emerging again. 

 

Could the server be seen from the internet the first time? Do you have a firewall blocking the way?

Are you using ipv6-addresses? If you are then having ipv6 in your USE-flags enables them(-ipv6 disables  :Razz:  )

----------

## Chris W

Try 

```
$ lynx http://127.0.0.1
```

 and report.

----------

## To

try a 

```
netstat -nlp
```

 and see what host Apache is lissen to.

Tó

----------

## gluc0se

http://127.0.0.1 --> Cannot connect

```
#netstat -nlp

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address           Foreign Address         State PID/Program name

Active UNIX domain sockets (only servers)

Proto RefCnt Flags       Type       State         I-Node PID/Program name    Path

unix  2      [ ACC ]     STREAM     LISTENING     4341   2439/mozilla-bin    /tmp/orbit-root/linc-987-0-567a6e77caa00

unix  2      [ ACC ]     STREAM     LISTENING     4180   2429/mozilla-bin    /tmp/orbit-root/linc-97d-0-629cbc8fde9bb

unix  2      [ ACC ]     STREAM     LISTENING     2023   1158/syslog-ng      /dev/log

unix  2      [ ACC ]     STREAM     LISTENING     4313   2415/mozilla-bin    /tmp/orbit-root/linc-96f-0-1c44428f9d17

unix  2      [ ACC ]     STREAM     LISTENING     3618   2399/nautilus       /tmp/orbit-root/linc-95f-0-7f22eb8968331

unix  2      [ ACC ]     STREAM     LISTENING     3701   2401/gnome-terminal /tmp/orbit-root/linc-961-0-2d34b4a855099

unix  2      [ ACC ]     STREAM     LISTENING     3790   2453/nautilus-throb /tmp/orbit-root/linc-995-0-24f9e5bb690e7

unix  2      [ ACC ]     STREAM     LISTENING     4285   2409/mozilla-bin    /tmp/orbit-root/linc-969-0-3dfb6c8d1fc4a

unix  2      [ ACC ]     STREAM     LISTENING     3038   2271/xfs            /tmp/.font-unix/fs-1

unix  2      [ ACC ]     STREAM     LISTENING     4371   2427/mozilla-bin    /tmp/orbit-root/linc-97b-0-7455783a94a84

unix  2      [ ACC ]     STREAM     LISTENING     4388   2431/mozilla-bin    /tmp/orbit-root/linc-97f-0-2be4d4b4404e6

unix  2      [ ACC ]     STREAM     LISTENING     4397   2445/mozilla-bin    /tmp/orbit-root/linc-98d-0-741a591f5bd25

unix  2      [ ACC ]     STREAM     LISTENING     4412   2423/mozilla-bin    /tmp/orbit-root/linc-977-0-398688b89e7bd

unix  2      [ ACC ]     STREAM     LISTENING     4436   2407/mozilla-bin    /tmp/orbit-root/linc-967-0-7e51c946e44cc

unix  2      [ ACC ]     STREAM     LISTENING     4447   2411/mozilla-bin    /tmp/orbit-root/linc-96b-0-eb3e3897280

unix  2      [ ACC ]     STREAM     LISTENING     3836   2425/mozilla-bin    /tmp/orbit-root/linc-979-0-4599a5cf6c958

unix  2      [ ACC ]     STREAM     LISTENING     3550   2379/metacity       /tmp/orbit-root/linc-94b-0-6f85033d3a2db

unix  2      [ ACC ]     STREAM     LISTENING     3466   2359/bonobo-activat /tmp/orbit-root/linc-937-0-63d752c7da28

unix  2      [ ACC ]     STREAM     LISTENING     4350   2447/mozilla-bin    /tmp/orbit-root/linc-98f-0-1d1d8983e5da6

unix  2      [ ACC ]     STREAM     LISTENING     4359   2443/mozilla-bin    /tmp/orbit-root/linc-98b-0-35d73ccbd61c

unix  2      [ ACC ]     STREAM     LISTENING     3973   2449/mixer_applet2  /tmp/orbit-root/linc-991-0-5c8cc5f828054

unix  2      [ ACC ]     STREAM     LISTENING     4124   2522/wnck-applet    /tmp/orbit-root/linc-9da-0-53a2f45c138a7

unix  2      [ ACC ]     STREAM     LISTENING     4328   2437/mozilla-bin    /tmp/orbit-root/linc-985-0-5075fe8eaa336

unix  2      [ ACC ]     STREAM     LISTENING     3594   2397/gnome-panel    /tmp/orbit-root/linc-95d-0-514b7249baea2

unix  2      [ ACC ]     STREAM     LISTENING     4207   2413/mozilla-bin    /tmp/orbit-root/linc-96d-0-887e6b587a7d

unix  2      [ ACC ]     STREAM     LISTENING     4216   2433/mozilla-bin    /tmp/orbit-root/linc-981-0-1b7d5f49a1612

unix  2      [ ACC ]     STREAM     LISTENING     3245   2336/gdm            /tmp/.gdm_socket

unix  2      [ ACC ]     STREAM     LISTENING     4225   2421/mozilla-bin    /tmp/orbit-root/linc-975-0-18a9cabebafff

unix  2      [ ACC ]     STREAM     LISTENING     3258   2339/X              /tmp/.X11-unix/X0

unix  2      [ ACC ]     STREAM     LISTENING     4237   2417/mozilla-bin    /tmp/orbit-root/linc-971-0-66bdad0445976

unix  2      [ ACC ]     STREAM     LISTENING     4254   2419/mozilla-bin    /tmp/orbit-root/linc-973-0-1b5661ded6a7b

unix  2      [ ACC ]     STREAM     LISTENING     3300   2354/ssh-agent      /tmp/ssh-xObg2345/agent.2345

unix  2      [ ACC ]     STREAM     LISTENING     3316   2356/gconfd-2       /tmp/orbit-root/linc-934-0-383b4697cbf3a

unix  2      [ ACC ]     STREAM     LISTENING     3325   2345/gnome-session  /tmp/orbit-root/linc-929-0-4ab1c9eada68c

unix  2      [ ACC ]     STREAM     LISTENING     3455   2345/gnome-session  /tmp/.ICE-unix/2345

unix  2      [ ACC ]     STREAM     LISTENING     3493   2363/gnome-settings /tmp/orbit-root/linc-93b-0-2b8f171ec8d97

```

And, no, it could never be accessed from the internet, at any point. I am not sure if I am ipv6, or what. I don't know anything about ipv4,5,6 at all actually. Anyone care to inform me?  :Very Happy: 

Thanks very much, again, guys...You're help is very well appreciated!                                                :Razz: 

----------

## gluc0se

Any ideas from that?

----------

## fleed

We actually need the output of "netstat -lnt", to see what's bound to what tcp socket. Unix domain sockets are not very useful at this stage.

----------

## duhmmm

then maybe we should try 

ps -A | grep apache

--- lets be sure the server is up and running.

----------

## gluc0se

```

#netstat -lnt

Active Internet Connections (only servers)

Proto Recv-Q Send-Q Local Address          Foreign Address      State

#ps -A | grep apache

#(Nothing happens)

```

----------

## lamekain

if ps -a |grep apache doesn't come up with anything, then your apache is not running. If you run /etc/init.d/apache2 start, does it say ok?

----------

## reconciledthief

I'm having a similar problem.  My apache server isn't starting at all

I downloaded 2.0.48 from httpd.apache.org, put it in /usr/src then tar xzvf'd it

I cd'd into the directory and did

```

./configure --enable-so --enable-ssl

make

make install

```

I got no errors when doing this.  I then edited my /usr/local/apache2/conf/httpd.conf file to suit my needs (I've done this many many times on Red Hat distros) and then did:

```
 /usr/local/bin/apache/bin/apachectl start
```

And nothing happens, no error is displayed, nothing--not even anything in my logs, it just goes to a empty command prompt.

Any ideas fellas?

Thanks![/code]

----------

## gluc0se

Ok wait, my mistake...

```

#ps -A |grep apache

25408 ? 00:00:00 apache2

25410 ? 00:00:00 apache2

25411 ? 00:00:00 apache2

25412 ? 00:00:00 apache2

25413 ? 00:00:00 apache2

25414 ? 00:00:00 apache2

25415 ? 00:00:00 apache2

```

[/code]

----------

## fleed

And still netstat -lnt is totally blank? If so try netstat -ln and post that. Also post /var/log/apache2/error_log

----------

## gluc0se

Ahh, forgot to repost that...

```

portalnexus root # netstat -tnl

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address           Foreign Address         State

tcp        0      0 :::8080                 :::*                    LISTEN

tcp        0      0 :::443                  :::*                    LISTEN

ERROR LOG:

                                                                                

[Thu Jan 01 00:17:55 2004] [notice] Digest: generating secret for digest authen$[Thu Jan 01 00:17:55 2004] [notice] Digest: done

[Thu Jan 01 00:17:56 2004] [notice] Apache/2.0.48 (Gentoo/Linux) configured -- $[Thu Jan 01 06:37:05 2004] [notice] Digest: generating secret for digest authen$[Thu Jan 01 06:37:05 2004] [notice] Digest: done

[Thu Jan 01 06:37:06 2004] [notice] Apache/2.0.48 (Gentoo/Linux) configured -- $[Thu Jan 01 17:03:13 2004] [error] [client 192.168.1.1] client denied by server$[Thu Jan 01 17:04:15 2004] [error] [client 192.168.1.1] client denied by server$[Thu Jan 01 17:04:42 2004] [error] [client 192.168.1.1] client denied by server$[Thu Jan 01 17:04:58 2004] [error] [client 192.168.1.1] client denied by server$[Thu Jan 01 17:05:04 2004] [error] [client 192.168.1.1] client denied by server$[Thu Jan 01 17:06:34 2004] [error] [client 192.168.1.1] client denied by server$[Thu Jan 01 17:07:00 2004] [error] [client 192.168.1.1] client denied by server$[Thu Jan 01 17:11:05 2004] [error] [client 192.168.1.1] client denied by server$[Thu Jan 01 17:12:42 2004] [error] [client 192.168.1.1] client denied by server$[Thu Jan 01 17:14:42 2004] [error] [client 192.168.1.1] client denied by server$[Thu Jan 01 17:15:30 2004] [error] [client 192.168.1.1] client denied by server$[Thu Jan 01 17:15:37 2004] [error] [client 192.168.1.1] client denied by server$[Sat Jan 03 04:14:37 2004] [notice] caught SIGTERM, shutting down

[Thu Jan 01 17:15:37 2004] [error] [client 192.168.1.1] client denied by server$[Sat Jan 03 04:14:37 2004] [notice] caught SIGTERM, shutting down

[Sat Jan 03 04:44:31 2004] [notice] Digest: generating secret for digest authen$[Sat Jan 03 04:44:31 2004] [notice] Digest: done

[Sat Jan 03 04:44:32 2004] [notice] Apache/2.0.48 (Gentoo/Linux) configured -- $[Sun Jan 04 07:09:48 2004] [notice] caught SIGTERM, shutting down

[Sun Jan 04 07:12:51 2004] [notice] Digest: generating secret for digest authen$[Sun Jan 04 07:12:51 2004] [notice] Digest: done

[Sun Jan 04 07:12:52 2004] [notice] Apache/2.0.48 (Gentoo/Linux) configured -- $[Sun Jan 04 08:20:07 2004] [notice] caught SIGTERM, shutting down

[Fri Jan 09 06:59:51 2004] [notice] Digest: generating secret for digest authen$[Fri Jan 09 06:59:51 2004] [notice] Digest: done

[Fri Jan 09 06:59:52 2004] [notice] Apache/2.0.48 (Gentoo/Linux) configured -- $[Fri Jan 09 07:08:20 2004] [notice] caught SIGTERM, shutting down

[Fri Jan 09 07:11:22 2004] [notice] Digest: generating secret for digest authen$[Fri Jan 09 07:11:22 2004] [notice] Digest: done

[Fri Jan 09 07:11:23 2004] [notice] Apache/2.0.48 (Gentoo/Linux) configured -- $[Fri Jan 09 07:15:19 2004] [notice] caught SIGTERM, shutting down

[Fri Jan 09 07:18:38 2004] [notice] Digest: generating secret for digest authen$[Fri Jan 09 07:15:19 2004] [notice] caught SIGTERM, shutting down

[Fri Jan 09 07:18:38 2004] [notice] Digest: generating secret for digest authen$[Fri Jan 09 07:18:38 2004] [notice] Digest: done

[Fri Jan 09 07:18:39 2004] [notice] Apache/2.0.48 (Gentoo/Linux) configured -- $[Sat Jan 10 05:59:13 2004] [notice] caught SIGTERM, shutting down

[Sun Jan 11 04:15:45 2004] [notice] Digest: generating secret for digest authen$[Sun Jan 11 04:15:45 2004] [notice] Digest: done

[Sun Jan 11 04:15:46 2004] [notice] Apache/2.0.48 (Gentoo/Linux) configured -- $[Sun Jan 11 06:29:40 2004] [notice] caught SIGTERM, shutting down

[Sun Jan 11 06:29:43 2004] [notice] Digest: generating secret for digest authen$[Sun Jan 11 06:29:43 2004] [notice] Digest: done

[Sun Jan 11 06:29:44 2004] [notice] Apache/2.0.48 (Gentoo/Linux) configured -- $[Sun Jan 11 07:34:45 2004] [notice] caught SIGTERM, shutting down

[Sun Jan 11 07:34:47 2004] [notice] Digest: generating secret for digest authen$[Sun Jan 11 07:34:47 2004] [notice] Digest: done

[Sun Jan 11 07:34:48 2004] [notice] Apache/2.0.48 (Gentoo/Linux) configured -- $[Sun Jan 11 07:50:54 2004] [notice] caught SIGTERM, shutting down

[Sun Jan 11 09:13:01 2004] [notice] Digest: generating secret for digest authen$[Sun Jan 11 09:13:01 2004] [notice] Digest: done

[Sun Jan 11 09:13:01 2004] [notice] Digest: generating secret for digest authen$[Sun Jan 11 09:13:01 2004] [notice] Digest: done

[Sun Jan 11 09:13:02 2004] [notice] Apache/2.0.48 (Gentoo/Linux) configured -- $[Sun Jan 11 09:15:48 2004] [error] [client 127.0.0.1] File does not exist: /var$[Sun Jan 11 09:16:59 2004] [error] [client 127.0.0.1] File does not exist: /var$[Sun Jan 11 09:17:12 2004] [error] [client 127.0.0.1] File does not exist: /var$[Sun Jan 11 09:19:44 2004] [notice] caught SIGTERM, shutting down

[Sun Jan 11 09:19:50 2004] [notice] Digest: generating secret for digest authen$[Sun Jan 11 09:19:50 2004] [notice] Digest: done

[Sun Jan 11 09:19:51 2004] [notice] Apache/2.0.48 (Gentoo/Linux) mod_ssl/2.0.48$[Sun Jan 11 09:45:23 2004] [notice] caught SIGTERM, shutting down

[Sun Jan 11 09:45:32 2004] [notice] Digest: generating secret for digest authen$[Sun Jan 11 09:45:32 2004] [notice] Digest: done

[Sun Jan 11 09:45:33 2004] [notice] Apache/2.0.48 (Gentoo/Linux) mod_ssl/2.0.48$[Sun Jan 11 09:48:19 2004] [notice] caught SIGTERM, shutting down

[Sun Jan 11 09:48:33 2004] [notice] Digest: generating secret for digest authen$[Sun Jan 11 09:48:34 2004] [notice] Digest: done

[Sun Jan 11 09:48:35 2004] [notice] Apache/2.0.48 (Gentoo/Linux) mod_ssl/2.0.48$[Sun Jan 11 09:57:03 2004] [notice] caught SIGTERM, shutting down

                                                                                

[Sun Jan 11 09:48:35 2004] [notice] Apache/2.0.48 (Gentoo/Linux) mod_ssl/2.0.48$[Sun Jan 11 09:57:03 2004] [notice] caught SIGTERM, shutting down

[Sun Jan 11 11:23:41 2004] [notice] Digest: generating secret for digest authen$[Sun Jan 11 11:23:41 2004] [notice] Digest: done

[Sun Jan 11 11:23:42 2004] [notice] Apache/2.0.48 (Gentoo/Linux) mod_ssl/2.0.48$[Sun Jan 11 11:27:24 2004] [notice] caught SIGTERM, shutting down

[Sun Jan 11 11:27:29 2004] [notice] Digest: generating secret for digest authen$[Sun Jan 11 11:27:29 2004] [notice] Digest: done

[Sun Jan 11 11:27:30 2004] [notice] Apache/2.0.48 (Gentoo/Linux) mod_ssl/2.0.48$[Sun Jan 11 22:23:07 2004] [notice] caught SIGTERM, shutting down

[Sun Jan 11 22:23:11 2004] [notice] Digest: generating secret for digest authen$[Sun Jan 11 22:23:11 2004] [notice] Digest: done

[Sun Jan 11 22:23:12 2004] [notice] Apache/2.0.48 (Gentoo/Linux) mod_ssl/2.0.48$[Sun Jan 11 22:23:58 2004] [notice] caught SIGTERM, shutting down

[Sun Jan 11 22:37:28 2004] [notice] Digest: generating secret for digest authen$[Sun Jan 11 22:37:28 2004] [notice] Digest: done

[Sun Jan 11 22:37:29 2004] [notice] Apache/2.0.48 (Gentoo/Linux) PHP/4.3.3 conf$[Sun Jan 11 23:15:27 2004] [notice] caught SIGTERM, shutting down

[Sun Jan 11 23:15:32 2004] [notice] Digest: generating secret for digest authen$

[Sun Jan 11 23:15:32 2004] [notice] Digest: generating secret for digest authen$[Sun Jan 11 23:15:32 2004] [notice] Digest: done

[Sun Jan 11 23:15:33 2004] [notice] Apache/2.0.48 (Gentoo/Linux) PHP/4.3.3 conf$[Mon Jan 12 00:28:27 2004] [notice] caught SIGTERM, shutting down

[Mon Jan 12 00:28:46 2004] [alert] (EAI 2)Name or service not known: mod_unique$Configuration Failed

                                                                                

[Mon Jan 12 00:30:00 2004] [alert] (EAI 2)Name or service not known: mod_unique$                                                                                

[Mon Jan 12 00:30:00 2004] [alert] (EAI 2)Name or service not known: mod_unique$Configuration Failed

                                                                                

[Mon Jan 12 03:32:31 2004] [alert] (EAI 2)Name or service not known: mod_unique$Configuration Failed

                                                                                

[Mon Jan 12 03:33:18 2004] [notice] Digest: generating secret for digest authen$[Mon Jan 12 03:33:18 2004] [notice] Digest: done

[Mon Jan 12 03:33:19 2004] [notice] Apache/2.0.48 (Gentoo/Linux) mod_ssl/2.0.48$[Mon Jan 12 04:34:37 2004] [notice] caught SIGTERM, shutting down

[Wed Jan 14 19:22:02 2004] [notice] Digest: generating secret for digest authen$[Wed Jan 14 19:22:02 2004] [notice] Digest: done

[Wed Jan 14 19:22:03 2004] [notice] Apache/2.0.48 (Gentoo/Linux) mod_ssl/2.0.48$

```

A lot...  :Embarassed: 

----------

## fleed

What happens when you connect to http://localhost:8080/ ? And https://localhost:443/ ? Sounds like it's listening on port 8080 instead of the normal 80.

----------

## gluc0se

Ah, there we go.

 :Smile: 

But...It still can't connect through the internet  :Sad: 

I am using ZoneEdit to point to my server. Any clues why?

Thanks again for your help so far guys, you're great  :Smile: 

----------

## lamekain

Open the file /etc/apache2/conf/commonapache2.conf and check out these lines: 

```
###

### Each directory to which Apache has access, can be configured with respect

### to which services and features are allowed and/or disabled in that

### directory (and its subdirectories). 

###

### First, we configure the "default" to be a very restrictive set of 

### permissions.  Also, for security, we disable indexes globally.

###

### Restricted set of options:

###

<Directory />

  Options -All -Multiviews

  AllowOverride None

  <IfModule mod_access.c>

    Order deny,allow

    Deny from all

  </IfModule>

</Directory>

<Directory /home/abuser/www>

  Options -All -Multiviews

  AllowOverride None

  <IfModule mod_access.c>

    Order deny,allow

    ###Deny from all(nobody has access)

   Allow from 127.0.0.1

  </IfModule>

</Directory>
```

The first section says, that nobody has access to my /. In the next section I defined that my /home/abuser/www directory may be accessed by localhost. The default was "Deny from all". I think (haven't tried), that by writing Allow from all you grant everyone on the net access to your server.

----------

## fleed

This could be a series of things! Forget zoneedit for now. What happens when you try connecting to your server from the internet when you specify the ip address and port number. As in entering http://1.2.3.4:8080/ on your browser? If it fails, post the results of "tail /var/log/apache2/access_log". If it doesn't fail it's a problem with your zoneedit configuration. Also, what happens when you try connecting to http://1.2.3.4:443/ on your browser? The same? Different message? 

Are you sure your ISP is not blocking port 8080?

----------

