# Not able to start Apache



## mrfree (Mar 6, 2013)

Hello FreeBSD Community, I come before you seeking enlightenment.

I have been away from FreeBSD for several months due to my CCNA and other studies consuming me. When I got around to messing with my server I wasn't able to start Apache. After searching around to no avail, I beg for direction.
So here is what I got


```
>service apache22 start
kldload: cant load accf_data: Operation not permitted
Perfroming insanity check on apache22 configuration:
Syntax OK
Starting apache22
(13)Permission denied: make_sock: could not bind to address 10.0.0.4:80
no listening sockets available , shutting down
Unable to open logs
/usr/local/etc/rc.d/apache22: Warning: failed to start Apache
>service -e
/etc/rc.d/hostid
/etc/rc.d/hostid_save
/etc/rc.d/ip6addrctl
/etc/rc.d/cleanvar
/etc/rc.d/devd
/etc/rc.d/newsyslogd
/etc/rc.d/syslogd
/etc/rc.d/dmesg
/etc/rc.d/virecover
/etc/rc.d/motpd
/etc/rc.d/htpd
/usr/local/etc/rc.d/mysql-server
/etc/rc.d/moused
/usr/local/etc/rc.d/dbus
/usr/local/etc/rc.d/hald
/usr/local/etc/rc.d/apache22
/etc/rc.d/sendmail
/etc/rc.d/cron
/etc/rc.d/mixer
/etc/rc.d/gptboot
/etc/rc.d/bgfsck
```

The 10.0.0.4:80 was commented out originally, I had just changed it before getting this message again.

*H*ere is the rc.conf:

```
hostname='theorphange'
ifconfig_fxp0='DHCP'
moused_enable='YES'
ntpd_enable='YES'
dumpdev='NO'
dbus_enable='YES'
hald_enable='YES'
linux_enable='YES'
apache22_enable='YES'
ssl_enable='YES'
mysql_enable='YES'
devfs_system_ruleset='localrules'
devfs_system_ruleset='system'
apache22_http_accept_enable='Yes'  # I just added this after viewing a previous thread on the same error message.
```


----------



## Savagedlight (Mar 6, 2013)

"Unable to load kernel module": Are you running with a kern.securelevel which prevents loading of kernel modules? Check with `$ sysctl kern.securelevel`. 

"Unable to bind to port <1024": Are you trying to start it as a normal user? You have to do this with root privileges.


----------



## SirDice (Mar 6, 2013)

Savagedlight said:
			
		

> Are you trying to start it as a normal user? You have to do this with root privileges.



Yes, that would be my guess too. If the prompt ends with *>* or *%* you are probably a regular user. Use su(1) or sudo(8) to become root.


----------



## wblock@ (Mar 6, 2013)

> ```
> Perfroming insanity check on apache22 configuration:
> ```



Really?


----------



## mrfree (Mar 6, 2013)

wblock@ said:
			
		

> Really?


Fml,I swear I looked at it and had an inner dialogue about my config file and I guess I projected that while writing. Either way I'm sorry for the mistake I wasn't trying to be funny. 



I thought I was able to boot FreeBSD and have all the daemons start without being logged in.
(forgive my ignorance) But using sudo fixed the socket error. 

I checked /var/log/httpd-error.log 

```
[Wed Mar 06 14:21:50 2013] [alert] (EAI 8)hostname nor servername provided, or not known: Mod_unique_id: Unable to find IPV4 address of "TheServer"
```

I wanted to respond to @wblock@ post so I haven't checked into this error yet, but I'm assuming that the host name isn't valid on my new xfinity network?

Edit: it's not the network


----------



## SirDice (Mar 6, 2013)

mrfree said:
			
		

> Fml,I swear I looked at it and had an inner dialogue about my config file and I guess I projected that while writing. Either way I'm sorry for the mistake I wasn't trying to be funny.


Well... I had a good laugh, but mainly because I hadn't seen it until @wblock@ elegantly pointed it out :q



> I thought I was able to boot FreeBSD and have all the daemons start without being logged in.
> (forgive my ignorance) But using sudo fixed the socket error.


Again in /etc/rc.conf:

```
apache22_enable="YES"
```



> I checked /var/log/httpd-error.log
> 
> ```
> [Wed Mar 06 14:21:50 2013] [alert] (EAI 8)hostname nor servername provided, or not known: Mod_unique_id: Unable to find IPV4 address of "TheServer"
> ...



Yes, it's a name resolving issue. But setting ServerName in /usr/local/etc/apache22/httpd.conf might help too.


----------



## mrfree (Mar 6, 2013)

Edit: I fixed the problem by commenting out unique_id.

Thanks for your help everyone


----------

