[SOLVED] httpd fails to start, no other errors

Patience please!

I tried to get a CentOS LAMP server up and running according to the Library. At first I couldn't start httpd because I hadn't made the appropriate directories, and then I had made a simple syntax typo. Now, however, starting httpd fails without any error messages, so I don't know what to fix.

Here is my /etc/httpd/conf.d/vhost.conf

NameVirtualHost 1.2.3.4:80

 <virtualhost 1.2.3.4:80="">ServerAdmin     [email protected]
        ServerName    example.com
        ServerAlias     www.example.com
        DocumentRoot    /srv/www/example.com/public_html
        ErrorLog        /srv/www/example.com/logs/error.log
        CustomLog    /srv/www/example.com/logs/access.log combined</virtualhost> 

 <virtualhost 1.2.3.4:80="">ServerAdmin    [email protected]
        ServerName    example.net
        ServerAlias     www.example.net
        DocumentRoot    /srv/www/example.net/public_html
        ErrorLog        /srv/www/example.netl/logs/error.log
        CustomLog    /srv/www/example.net/log/access.log combined</virtualhost> 

What did I miss?

9 Replies

@EchoLynx:

What did I miss?

Verify no configuration errors with:

apachectl -S

Check the error log:

/var/log/httpd/error_log

Travis

Thanks for the fast reply!

Output from apachectl -S

[[email protected] logs]# apachectl -S
VirtualHost configuration:
1.2.3.4:80       is a NameVirtualHost
         default server example.com (/etc/httpd/conf.d/vhost.conf:3)
         port 80 namevhost example.com (/etc/httpd/conf.d/vhost.conf:3)
         port 80 namevhost example.net (/etc/httpd/conf.d/vhost.conf:12)
Syntax OK

/var/log/httpd/errorlog contained a bunch of errors complaining about being unable to access access.log, so I created that file for both sites and cleared errorlog. Unfortunately, there is still more to be fixed.

error_log after /etc/init.d/httpd start

Unable to open logs

What's next?

It's probably a permissions problem, make sure apache has write permissions to it's log files.

My linux ineptitude is showing.

I tried to get the permissions the way I thought they would need to be, but apparently I am doing something wrong.

/svr/www/example.com/logs

[[email protected] logs]# ls -lsh
total 4.0K
4.0K -rwxr-x--x 1 apache apache 1 May 30 08:54 access.log
   0 -rwxr-x--x 1 apache apache 0 May 30 08:54 error.log

/svr/www/example.net/logs

[[email protected] logs]# ls -lsh
total 4.0K
4.0K -rwxr-x--x 1 apache apache 1 May 30 08:47 access.log
   0 -rwxr-x--x 1 apache apache 0 May 30 08:47 error.log
[[email protected] logs]# cat /var/log/httpd/error_log
Unable to open logs

ermm well you don't need execute permission on group and others.

You're probably going to want to chmod 0644 the logs and make sure the group is writable by the apache user which is probably either apache/apache2/www-data

I don't use apache but these are my nginx permissions which I imagine will be the same

-rw-r–--- 1 www-data adm 19K 2011-05-30 22:40 access.log

Well, I selected apache because that seemed to be the only webserver-ish user in /etc/passwd (see last line)

[[email protected] mail]# cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
news:x:9:13:news:/etc/news:
uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
gopher:x:13:30:gopher:/var/gopher:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
vcsa:x:69:69:virtual console memory owner:/dev:/sbin/nologin
pcap:x:77:77::/var/arpwatch:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
rpc:x:32:32:Portmapper RPC user:/:/sbin/nologin
mailnull:x:47:47::/var/spool/mqueue:/sbin/nologin
smmsp:x:51:51::/var/spool/mqueue:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
haldaemon:x:68:68:HAL daemon:/:/sbin/nologin
avahi-autoipd:x:100:102:avahi-autoipd:/var/lib/avahi-autoipd:/sbin/nologin
ntp:x:38:38::/etc/ntp:/sbin/nologin
apache:x:48:48:Apache:/var/www:/sbin/nologin

… and it appears to be in the correct group (last line)…

[[email protected] logs]# cat /etc/group
root:x:0:root
bin:x:1:root,bin,daemon
daemon:x:2:root,bin,daemon
sys:x:3:root,bin,adm
adm:x:4:root,adm,daemon
tty:x:5:
disk:x:6:root
lp:x:7:daemon,lp
mem:x:8:
kmem:x:9:
wheel:x:10:root
mail:x:12:mail
news:x:13:news
uucp:x:14:uucp
man:x:15:
games:x:20:
gopher:x:30:
dip:x:40:
ftp:x:50:
lock:x:54:
nobody:x:99:
users:x:100:
utmp:x:22:
utempter:x:35:
floppy:x:19:
vcsa:x:69:
pcap:x:77:
slocate:x:21:
dbus:x:81:
audio:x:63:
rpc:x:32:
mailnull:x:47:
smmsp:x:51:
sshd:x:74:
ecryptfs:x:101:
haldaemon:x:68:
avahi-autoipd:x:102:
screen:x:84:
ntp:x:38:
apache:x:48:

As for making apache (user) writeable to apache (group) - I don't know how to do that.

I can change the permissions, though.

[[email protected] logs]# ls -lsh
total 4.0K
4.0K -rw-r--r-- 1 apache apache 1 May 30 08:47 access.log
   0 -rw-r--r-- 1 apache apache 0 May 30 08:47 error.log

I don't know if this helps, bit on one of my centos 5 systems Apache (1, not 2) the logs are owned by root (and group root as well).

@haus:Tried changing back to root, but no luck. Thanks anyway.

I am running out of ideas. My next step will be to rebuild the box and start from scratch.

If that doesn't work, I don't know what will.

So after I backed up my files to another partition, deleted the current CentOS partition and created another, then reconfigured it as per the LAMP instructions linked earlier, I finally have an "OK" instead of "FAILED"!

In rebuilding, I remembered two other things I did to the old install:

1. Install and remove squid, and

2. remove the squid user.

Apparently they don't coexist very well.

Regardless, thank you obs, otherbbs and haus for your help and patience!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct