# Having trouble starting apache



## jigglywiggly (Nov 1, 2009)

So I just installed apache, and I am new to freebsd, but I do have a good amount of Linux experience.

So I just did 
	
	



```
/usr/ports/www/apache22
make install clean
```

Then I tried 
	
	



```
/usr/local/sbin/apachectl start
```

And I got some error, and apache didn't start. So then I went into the config and changed the ServerName to my domain, and I try to start it again, and got some error, I didn't record it, but here is my error log
	
	



```
[Sat Oct 31 22:33:07 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sat Oct 31 22:33:07 2009] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of ".local"
Configuration Failed
[Sat Oct 31 22:33:25 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sat Oct 31 22:33:25 2009] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of ".local"
Configuration Failed
[Sat Oct 31 22:33:47 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sat Oct 31 22:33:47 2009] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of ".local"
Configuration Failed
[Sat Oct 31 22:33:48 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sat Oct 31 22:33:48 2009] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of ".local"
Configuration Failed
[Sat Oct 31 22:33:55 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sat Oct 31 22:33:55 2009] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of ".local"
Configuration Failed
[Sat Oct 31 22:34:18 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sat Oct 31 22:34:18 2009] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of ".local"
Configuration Failed
[Sat Oct 31 22:34:22 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sat Oct 31 22:34:22 2009] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of ".local"
Configuration Failed
[Sat Oct 31 22:34:35 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sat Oct 31 22:34:35 2009] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of ".local"
Configuration Failed
[Sat Oct 31 22:36:21 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sat Oct 31 22:36:21 2009] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of ".local"
Configuration Failed
[Sat Oct 31 22:36:22 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sat Oct 31 22:36:22 2009] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of ".local"
Configuration Failed
[Sat Oct 31 22:36:23 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sat Oct 31 22:36:23 2009] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of ".local"
Configuration Failed
[Sat Oct 31 22:36:23 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sat Oct 31 22:36:23 2009] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of ".local"
Configuration Failed
[Sat Oct 31 22:45:23 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sat Oct 31 22:45:23 2009] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of ".local"
Configuration Failed
[Sat Oct 31 22:46:40 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sat Oct 31 22:46:40 2009] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of ".local"
Configuration Failed
[Sat Oct 31 22:46:50 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sat Oct 31 22:46:50 2009] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of ".local"
Configuration Failed
[Sat Oct 31 22:46:51 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sat Oct 31 22:46:51 2009] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of ".local"
Configuration Failed
[Sat Oct 31 22:48:26 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sat Oct 31 22:48:26 2009] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of ".local"
Configuration Failed
[Sat Oct 31 22:48:34 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sat Oct 31 22:48:34 2009] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of ".local"
Configuration Failed
```



Now I just relogged in, and I tried 
	
	



```
/usr/local/sbin/apachectl start
```
 to start it, and now it's saying command not found? 
I am really confused now.


----------



## dennylin93 (Nov 1, 2009)

My guess is that your configuration file has problems. Try reverting back to the one that comes during installation, or do `# apachectl configtest` to see what's wrong.

You seem to have some problems with the SSL and server name settings.


----------



## jigglywiggly (Nov 1, 2009)

Wait disregard the last part.


----------



## jigglywiggly (Nov 1, 2009)

When I ran apachectl configtest it just threw, 
	
	



```
Syntax OK
```


----------



## jigglywiggly (Nov 1, 2009)

Also when I do apachectl start I get No such file or directory: Failed to enable the httpready Accelt Filter.


----------



## dennylin93 (Nov 1, 2009)

What's the output of `# sockstat -4` after `# apachectl start`? Is there anything listening on port 80?


----------



## gilinko (Nov 1, 2009)

Your main problem is that you don't have a registered domain name, either in DNS or your hosts file(as can be seen from the logs). Take a closer look at the ServerName part of your configuration, and add your ip adress there(as stated by the documentation part just above.

And don't use apachectl, use the intended start/stop srcipt


```
/usr/local/etc/rc.d/apache22
```

and put this is your /etc/rc.conf file


```
apache22_enable="YES"
```


----------



## jigglywiggly (Nov 1, 2009)

Still no go I tried sockstat -4
and there is nothing running on port 80

I added apache22_enable="YES"
and rebooted, still nothing.

I went back in the config, and put my wan ip, lan ip, and still nothing.


----------



## gilinko (Nov 1, 2009)

Does your /etc/hosts and/or /etc/rc.conf file contain any hostname related to your computers ip adress?

What does your error logs say when you put your IP in the ServerName in your httpd.conf?


----------



## jigglywiggly (Nov 1, 2009)

No error comes up when I put its lan ip in the httpd.conf, and I didn't see anything related those files.

I am a bit stumped why this is happening, this is a fresh install of freebsd, basically with all the defaults... ?


----------



## jigglywiggly (Nov 1, 2009)

I just did another fresh install, it works now


----------



## huwenhuo (Nov 16, 2009)

*I have the similar problem*

it is my laptop installed with freebsd 7.1, and it is connected to internet by a wireless router. the IP address is configured by DHCP automaticly. and it usually is 192.168.1.100.

in my /etc/rc.conf with a line as: 

```
hostname="freebsd"
```
(is it right??)

in my /usr/local/etc/apache22/http.conf:

```
ServerName 192.168.1.100:80
```

in my /boot/loader.conf with a line as:

```
accf_http_load="YES"
```

the apache22 is installed by ports with default parameters.


```
/usr/local/etc/rc.d/apache22 start
```


```
[~]$tail /var/log/httpd-error.log 
[Sun Nov 15 20:26:55 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Sun Nov 15 20:26:55 2009] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of "freebsd"
Configuration Failed
```

any sugestion?


----------



## DutchDaemon (Nov 16, 2009)

Change your hostname to something like 'freebsd.domain.local', and put it in /etc/hosts as well.


----------



## huwenhuo (Nov 16, 2009)

comment out this line 

```
LoadModule unique_id_module libexec/apache2/mod_unique_id.so
```
in http.conf

then "it works!"


----------



## huwenhuo (Nov 16, 2009)

Thanks DutchDaemon, just find your reply.

Actually I comment out the hostname=freebsd line in the rc.conf. 

And comment out the 
	
	



```
LoadModule unique_id_module libexec/apache2/mod_unique_id.so
```
 line in httpd.conf.

Then it works, though I dont know how it happened.


----------



## DutchDaemon (Nov 16, 2009)

You can fix the cause of the error, or simply remove the error, sure ...


----------



## huwenhuo (Nov 16, 2009)

No time to fix this, just step forward learning.

Thanks any way.


----------



## skafte (Jan 13, 2011)

I know this is a LATE answear, but the best solution would be to actually have a fully qualified domain name which is set up pointing at the servers ip, or put the local ip + the domain in /etc/hosts if youre behind NAT. Then you dont need to disable anything.


----------



## wmoreno3 (Dec 24, 2012)

My Solution https://issues.apache.org/bugzilla/show_bug.cgi?id=23403

```
Require: /usr/ports/security/openssl/ installed
apachectl configtest // Must be a "OK"
Edit /usr/local/etc/apache22/httpd.conf file:
# Uncomment:
# Include etc/apache22/extra/httpd-ssl.conf

Edit /usr/local/etc/apache22/extra/httpd-ssl.conf:

# Uncomment and change to your domain name:
# ServerName www.my_domain.org:443

# Uncomment and change to your mail address:
# ServerAdmin webmaster@my_domain.org

And run:
cd /usr/local/openssl/certs/
/usr/local/bin/openssl genrsa -des3 -out server.key 1024
/usr/local/bin/openssl req -new -key server.key -out server.csr
cp server.key server.key.org
/usr/local/bin/openssl rsa -in server.key.org -out server.key
/usr/local/bin/openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
cp server.key /usr/local/etc/apache22/
cp server.crt /usr/local/etc/apache22/
chmod 0400 /usr/local/etc/apache22/server.key
chmod 0400 /usr/local/etc/apache22/server.crt

Restart Apache...

Configuring SSL Enabled Virtual Hosts 

SSLEngine on
SSLCertificateFile		/usr/local/etc/apache22/server.crt
SSLCertificateKeyFile	/usr/local/etc/apache22/server.key
```


----------



## jwele (Feb 6, 2013)

DutchDaemon said:
			
		

> Change your hostname to something like 'freebsd.domain.local', and put it in /etc/hosts as well.



I apologize for the "necro" but this solution solved my version of the OP's problem. I am adding this comment to help the future googlers of the world to fix the problem without excluding modules as OP did to fix his issue.


----------



## ramin (Jun 1, 2014)

Add your domain name to  /etc/hosts:

```
127.0.0.1               localhost localhost.my.domain    a.domain.local
192.168.1.32            localhost a.domain.local
```


----------

