Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have apache2 installed on Amazon Linux AMI release 2012.03. I'm able to start it manually just fine, without any errors using /etc/init.d/httpd start. However, it doesn't start automatically when the machine is booted up.

It appears that everything is configured properly in my rc*.d directories. Here's the result of find /etc/rc.d -name "*httpd*" | xargs ls -l:

-rwxr-xr-x 1 root root 3371 Feb 16  2012 /etc/rc.d/init.d/httpd
lrwxrwxrwx 1 root root   15 Apr 14  2012 /etc/rc.d/rc0.d/K15httpd -> ../init.d/httpd
lrwxrwxrwx 1 root root   15 Apr 14  2012 /etc/rc.d/rc1.d/K15httpd -> ../init.d/httpd
lrwxrwxrwx 1 root root   15 Apr 14  2012 /etc/rc.d/rc2.d/K15httpd -> ../init.d/httpd
lrwxrwxrwx 1 root root   15 Apr 14  2012 /etc/rc.d/rc3.d/K15httpd -> ../init.d/httpd
lrwxrwxrwx 1 root root   15 Apr 14  2012 /etc/rc.d/rc4.d/K15httpd -> ../init.d/httpd
lrwxrwxrwx 1 root root   15 Apr 14  2012 /etc/rc.d/rc5.d/K15httpd -> ../init.d/httpd
lrwxrwxrwx 1 root root   15 Apr 14  2012 /etc/rc.d/rc6.d/K15httpd -> ../init.d/httpd

I understand that I can put the /etc/init.d/httpd start command into /etc/rc.local, but isn't that a workaround? Why isn't it starting automatically? Other stuff in the rc*.d directories starts just fine on bootup (mongod, postfix, etc). Thanks!

share|improve this question
    
Mike, I think you can use chkconfig --list and chkconfig on with the Amazon AMI distro. –  JasonAzze Jan 24 '13 at 19:00
    
chkconfig --list shows httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off ... so how do I turn them on? Thanks! –  Mike Cialowicz Jan 24 '13 at 19:06
add comment

2 Answers

up vote 5 down vote accepted

Use chkconfig to manage the runlevels under which you want this service to start.

Usually chkconfig httpd on does the job.

share|improve this answer
    
That did the trick, thanks! –  Mike Cialowicz Jan 24 '13 at 19:27
add comment

You do not have any "S" links. All the "K" are shutdown only. Add links with same name, just replace the K with S.

"In general, the system starts commands that begin with the letter "S" and stops commands that begin with the letter "K." Commands that begin with the letter "K" run only when the system is changing run levels from a higher to a lower level. Commands that begin with the letter "S" run in all cases."

If using chkconfig, see "man chkconfig". For your case:

chkconfig --level 2345 httpd on

should do.

share|improve this answer
1  
Ah, that works too, thank you! Upvoted. –  Mike Cialowicz Jan 24 '13 at 19:27
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.