# Can't start apache22



## folivora (Oct 17, 2011)

Hi,

I have problems to get apache22 up and running. It was previously working without any problems, after rebooting the server it wont start up. I didn't change anything in the /usr/local/etc/apache22/httpd.conf.

When I run [CMD=""]apachectl start[/CMD]

I get following messages: 


```
/usr/local/etc/rc.d/apache22: DEBUG: checkyesno: apache22_http_accept_enable is set to NO.
/usr/local/etc/rc.d/apache22: DEBUG: pid file (/var/run/httpd.pid): not readable.
/usr/local/etc/rc.d/apache22: DEBUG: checkyesno: apache22_enable is set to YES.
/usr/local/etc/rc.d/apache22: DEBUG: run_rc_command: restart_precmd: apache22_checkconfig 
Performing sanity check on apache22 configuration:
Syntax OK
/usr/local/etc/rc.d/apache22: DEBUG: pid file (/var/run/httpd.pid): not readable.
/usr/local/etc/rc.d/apache22: DEBUG: checkyesno: apache22_enable is set to YES.
apache22 not running? (check /var/run/httpd.pid).
/usr/local/etc/rc.d/apache22: DEBUG: pid file (/var/run/httpd.pid): not readable.
/usr/local/etc/rc.d/apache22: DEBUG: checkyesno: apache22_enable is set to YES.
/usr/local/etc/rc.d/apache22: DEBUG: run_rc_command: start_precmd: apache22_prestart 
Performing sanity check on apache22 configuration:
Syntax OK
/usr/local/etc/rc.d/apache22: DEBUG: checkyesno: apache22limits_enable is set to NO.
Starting apache22.
/usr/local/etc/rc.d/apache22: DEBUG: run_rc_command: doit: /usr/local/sbin/httpd  -DNOHTTPACCEPT 
/usr/local/etc/rc.d/apache22: WARNING: failed to start apache22
```

I am running apache22  inside of a jail. 

Also on the hostsystem side I have enabled accf_http via


```
accf_http_load="YES"
```
 in  /boot/loader.conf

Any ideas where to start looking for errors, I have checked logs but I can't find anything about the problem from there.

Best Regards 

Folivora


----------



## SirDice (Oct 17, 2011)

Look in the apache errorlog.


----------



## folivora (Oct 17, 2011)

From log-file I can see that it can't find Ipv4-address.


```
[Mon Oct 17 14:57:29 2011] [alert] (EAI 8)hostname nor servname provided, or not known: mod_unique_id: unable to find IPv4 address of "my.hostname.biz" Configuration Failed
```

When I check my /etc/rc.conf, hostname, /etc/hosts

All of these do have my.hostname.biz, also when I do nslookup my.hostname.biz, our internal dns-server resolves my.hostname.biz.

What I have understand all of these names should match, so apache22 would work?

Best Regards

Folivora


----------



## drhowarddrfine (Oct 17, 2011)

Did you set the server name and ip in httpd.conf?


----------



## folivora (Oct 17, 2011)

I have these in my httpd.conf


```
Listen xxx.xxx.xxx:80
ServerName my.hostname.biz:80
```

So yes I have set up these in my /usr/local/etc/apache22/httpd.conf.

Any other ideas about this problem

Best Regards

- folivora


----------



## folivora (Oct 17, 2011)

Solved.

It seems that somehow /usr/local/etc/apach22/httpd.conf was corrupted. I could read it with any txt-editor, but when starting apach22 it had some things wrong. When replacing httpd.conf from backups everything started to work.

Thanks

- folivora


----------



## DutchDaemon (Oct 17, 2011)

That usually happens when exiting from an editor too quickly, causing a random ^@ type character at the start of the file. Almost impossible to spot, but detrimental to most applications depending on clean ascii.


----------



## wblock@ (Oct 17, 2011)

Is that specific to a certain editor?


----------



## DutchDaemon (Oct 17, 2011)

I've seen it happen when invoking an editor "carelessly", e.g. by typing something on the command line (still, or too soon) when the editor is starting, or by exiting from an editor by being too careless with Esc+something or Ctl+something keys. So let's call it "stray keystrokes".


----------



## SirDice (Oct 18, 2011)

DutchDaemon said:
			
		

> So let's call it "stray keystrokes".


Like the inevitable :wq I leave around in Word documents and emails :\


----------

