# Help with apache2



## Anonymous (Mar 9, 2009)

I am trying to setup apache2 without having to give it a domain name. All I have done so far was install it, no configuration.
When I start it I get the message:

```
httpd: apr_sockaddr_info_get() failed for
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[Mon Mr 09 23:10:27 2009] [warn] (2)No such file or directory: Failed to enable the 'httpready' Accept Filter
```

And then when I try to test the server using my local network address in a browser the browser tells me:



> Failed to Connect
> 
> Firefox can't establish a connection to the server at 192.168.2.3.
> 
> Though the site seems valid, the browser was unable to establish a connection.


----------



## Mel_Flynn (Mar 10, 2009)

Can you connect to localhost?


----------



## Anonymous (Mar 10, 2009)

Nope, 'connection refused'. I changed the config file so that my ip address is the domain name and did 'kldload accf_http'. Now when I start apache I get no error messages, in fact I get no message whatsoever. Still can't connect to the server.


----------



## Anonymous (Mar 10, 2009)

another thing i noticed was that when i stop httpd it tells me 'httpd (no pid file) not running' as if its not even starting..


----------



## graudeejs (Mar 10, 2009)

What do you expect apache to do?
You don't host any page yet....
[i haven't been using apache, I'm desktop user, but really, what do you expect it to do, when there's nothing for it to actually do?]

if you want to check if you can connect to pc simply try this [line with nc]
http://forums.freebsd.org/showpost.php?p=5965&postcount=3
[that is not apache related... but....]


----------



## gilinko (Mar 10, 2009)

How do you start your apache server? Using the apachectl command or the rc script in /usr/local/etc/rc.d?

What is the output of "ps ax | grep httpd" when you have started the server?(ie does the server actually start?)


----------



## Anonymous (Mar 10, 2009)

I've been using apachectl.
after 'apachectl' , 'ps ax | grep httpd' returns
4123  v0  R+  0:00.00 grep httpd

In a linux forum I saw the following response to a similar problem:


> I think that I had the same problem as you and discovered the way to fix it. Basically within /etc/default/apache2 the variable NO_START was set to 1, change this to 0 and then /etc/init.d/apache2 will create the /var/run/apache2 directory and be able to start. Hope this helps.



But I have no idea where the corresponding file to /etc/default/apache2 would be in freebsd


----------



## graudeejs (Mar 10, 2009)

All installed aps and their files are in /usr/local under freebsd

so look in /usr/local/etc/apache*

there also
man find which i use a lot


----------



## gilinko (Mar 10, 2009)

mickeyharvey70 said:
			
		

> I've been using apachectl.
> after 'apachectl' , 'ps ax | grep httpd' returns
> 4123  v0  R+  0:00.00 grep httpd
> 
> ...



First of all that indicates that the server isn't started at all, so it's no surprise that you can't connect to it. Also start using the rc script instead of the apachectl program.

Edit /etc/rc.conf and set (as documented in the rc script) _apache22_enable="YES"_, and then run _/usr/local/etc/rc.d/apache22 configtest_. If you get a "Syntax OK", then start the server using the same script.


----------



## Anonymous (Mar 10, 2009)

thanks killa.
glinko, that doesn't work, tried it already.


----------



## gilinko (Mar 10, 2009)

mickeyharvey70 said:
			
		

> glinko, that doesn't work, tried it already.



Exactly what doesn't work? You do have a rc.conf file? you do have the apache22 script in the rc.d directory? you have the apacheXX_enable in your rc.conf file?


----------



## Anonymous (Mar 10, 2009)

All of the above.


----------



## ale (Mar 10, 2009)

What do you get running `# /usr/local/etc/rc.d/apache22 forcestart`?
Can you see something relevant in /var/log/httpd-error.log after running the command?


----------



## Anonymous (Mar 10, 2009)

Tried that, it says is starting, but when I check it's not running.

Every time I try starting it, the following error shows up int the error log. (dont know what's up with the time, its way off)


```
[Tue Mar 10 08:16:44 2009] [warn] Init: Session Cache is not configured [hint: SLSessionCache]
[Tue Mar 10 08:16:44 2009] [alert] (EAI 8)hostname nor servname provided, or not 
known: mod_unique_id: unable to find IPv4 address of ""
Configuration Failed
```


----------



## ale (Mar 10, 2009)

What is the output of `$ hostname`?


----------



## graudeejs (Mar 10, 2009)

add 
*hostname="my.test.box.com"*
to /etc/rc.conf


----------



## Anonymous (Mar 10, 2009)

the output of host name is blank line.
I just added that to rc.conf and restarted apache, same error in the error log though


----------



## ale (Mar 10, 2009)

Do you have something like _127.0.0.1 your.host.name_ in /etc/hosts?


----------



## Anonymous (Mar 10, 2009)

yeah


----------



## ale (Mar 10, 2009)

I you just added something to /etc/rc.conf, do a _shutdown now_, press enter when asked about the shell and type exit.


----------



## Anonymous (Mar 10, 2009)

I think that worked.


----------



## Anonymous (Mar 10, 2009)

http://24.21.108.146:80 Was it because I didnt have a hostname?


----------



## graudeejs (Mar 10, 2009)

if you ask me, yes

*[Tue Mar 10 08:16:44 2009] [alert] (EAI 8)hostname nor servname provided, or not 
known: mod_unique_id: [red]unable to find IPv4 address of ""[/red]
Configuration Failed*


----------



## ale (Mar 10, 2009)

mickeyharvey70 said:
			
		

> http://24.21.108.146:80


*FreeBSD kicks ass!*


----------

