# Uh, Connection Refused?

## G-Style

Ok here's the thing I installed apache2 last night and everything was working well, I was able to access my site, but today I can't see my site when I type in the URL it says connection refused or there was an error loading the page. How could this be when I didnt really do anything to apache but and a page and a picture?

And another thing apache2 is running but still get the error message.

----------

## G-Style

Can some one please help me out here? What could cause this problem?

----------

## ryan83vt

We'll need more info than that to help fix your problem. 

First of all, what do you mean by "the URL". Are you talking about a domain that you have pointing to your IP? Have you tried typing in your IP instead of the url? Have you tried localhost?

You're sure that apache is running? You've run 

$/etc/init.d/apache2 start

and you've run 

$rc-update add apache2 boot

to make it start when you boot up?

Try restarting it...

```

$/etc/init.d/apache2 stop

$/etc/init.d/apache2 start

```

Oh and BTW you're not supposed  to "bump" your threads up, which is essentially what the reply to your own post is...

----------

## G-Style

Well i can access it via localhost. I've set up a site at dyndns.org but when i type in my url now all it does is just time out. It was working Friday night, but hasn't work for the past 2 days. And yes apache2 does boot up at start up, and it is currently running but it keeps on timing out when I type in a URL or my IP.

----------

## ozukir@

What does netstat show? Is it listening on port 80? Is it bound to an interface? When you attempt to contact your server does netstat show the syn sent?

If you want to access your local apache then you should make sure that your fqdn is set up in /etc/hosts to resolve back to your loopback address. You should also set your ServerName directive in the apache2.conf

```
ServerName www.mywebserver.com:80
```

I had a similar problem when I was running my webserver behind a port forwarding nating firewall. The address was resolving to my cable modem, so the packets were being sent out. Cable modems don't work like a regular interface so they didn't "loopback"

Try one of the web proxies like anonymizer.com to see how everything works outside your network.

Forgot to mention. You probably want apache to start at the default runlevel. The interfaces are usually brought up at the default level so this will cause the rc-script dependencies to get all shifted around. Check out "rc-update show" for more info on your configured runlevels.

----------

## G-Style

I am unable to locate the syn set when I type when im searching through netstat, likewise I don't see any port 80 open. How would I open this port to accept connections?

Also I get this error message when I stop apache2

 *Quote:*   

> 
> 
> (98)Address already in use: make_sock: could not bind to address [::]:80
> 
> no listening sockets available, shutting down
> ...

 

----------

## stonent

What are the permissions in your htdocs directory? You may want to set the files +r for all users.

----------

## ozukir@

When apache is properly configured and started it will be listening of port 80 (unless you've configured it otherwise). If nothing is listening on that port then this is a strange error. Check for any defunct apache processes or any processes that would listen on port 80. Make sure that your apache2.conf has something like these directives

```
Listen 127.0.0.1:80

Listen 192.168.internal.lan:80
```

 and does not include the BindAddress directive. Also make sure that the ServerName directive is something appropriated for your configuration.

What do the apache logs say when you receive that start-up message?

----------

## ozukir@

Checked it on my system. That's the error message I get when I try to start apache and have it listen on an interface that hasn't been configured.

----------

## G-Style

Ok, seems like the error is gone now.

But when I access my site via url it doesnt work it says the connection was refused, how do I unable connections? But as usall I was able to access my site through localhost.

----------

