Can't create a working init.d for Apache 2.4.2 on CentOS

Dustin asked:

I built apache 2.4.2 on CentOS from source and now am trying to create an init.d script to go along with it. A friend gave me one script but it never outputted a success or fail and I disliked it. I found in the tar a httpd.init script file. It just needed the location of apache changed but besides that seemed like it would work. However, it fails to stop httpd. It will start just fine however. Below is my current script in /etc/init.d/httpd. I found on this other topic: Restarting the httpd service in RHEL returns "Stopping httpd: [FAILED]" – How do I fix this? to check that a pid file is created in the /var/run directory but it is not being created there even when starting with service httpd start or the init.d script directly. I’m still fairly new to linux so please explain as much as possible. I’m a fast learner.

Can anyone help me find what’s wrong with this script? I’m running CentOS 6.3 x86_x64.

http://pastebin.com/sucmvBF6

My answer:


Remi has httpd 2.4.2 in his github repo, though he doesn’t seem to have built it yet (or it doesn’t yet work) as I don’t see RPMs for it yet. But you may be able to take his stuff and build RPMs.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.