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 noticed a strange behavior of Apache on my own Amazon installation of a RHEL 6.4.

After launching a Red Hat Enterprise Linux 6.4 AMI I installed the http package with yum, configured apache, and set runlevels with chkconfig.

The problem is that if I launch httpd immediately stops:

 [root@ip-xxxxxinit.d]# service httpd start
 Starting httpd: [ OK ]
 [root@xxxx init.d]# ps -eaf |grep http
 root 1818 1438 0 04:56 pts/0 00:00:00 grep http
 [root@ip-xxxxx init.d]# /etc/init.d/httpd start
 Starting httpd: [ OK ]
 [root@ip-xxxxx init.d]# ps -eaf |grep http
 root 1827 1438 0 04:57 pts/0 00:00:00 grep http

If I launch the same with the bash command before, it goes:

 [root@ip-xxxxx ~]# bash /etc/init.d/httpd start
 Starting httpd: [ OK ]
 [root@ip-xxxxx ~]# ps -eaf |grep http
 root 1837 1 1 04:59 ? 00:00:00 /usr/sbin/httpd
 apache 1839 1837 0 04:59 ? 00:00:00 /usr/sbin/httpd
 apache 1840 1837 0 04:59 ? 00:00:00 /usr/sbin/httpd
 apache 1841 1837 0 04:59 ? 00:00:00 /usr/sbin/httpd
 apache 1842 1837 0 04:59 ? 00:00:00 /usr/sbin/httpd
 apache 1843 1837 0 04:59 ? 00:00:00 /usr/sbin/httpd
 apache 1844 1837 0 04:59 ? 00:00:00 /usr/sbin/httpd
 apache 1845 1837 0 04:59 ? 00:00:00 /usr/sbin/httpd
 apache 1846 1837 0 04:59 ? 00:00:00 /usr/sbin/httpd
 root 1848 1656 0 04:59 pts/1 00:00:00 grep http

Then I create a minimal file with with the apache function and the command in the start function of start/stop script it works:

 [root@ip-xxxxx init.d]# cat test
 #!/bin/sh
 . /etc/rc.d/init.d/functions
 daemon --pidfile=/var/run/httpd/httpd.pid /usr/sbin/httpd
 [root@ip-10-0-0-77 init.d]# ./test
 [root@ip-10-0-0-77 init.d]# ps -eaf |grep http [ OK ]
 root 1932 1 3 05:02 ? 00:00:00 /usr/sbin/httpd
 apache 1933 1932 0 05:02 ? 00:00:00 /usr/sbin/httpd
 apache 1934 1932 0 05:02 ? 00:00:00 /usr/sbin/httpd
 apache 1935 1932 0 05:02 ? 00:00:00 /usr/sbin/httpd
 apache 1936 1932 0 05:02 ? 00:00:00 /usr/sbin/httpd
 apache 1937 1932 0 05:02 ? 00:00:00 /usr/sbin/httpd
 apache 1938 1932 0 05:02 ? 00:00:00 /usr/sbin/httpd
 apache 1939 1932 0 05:02 ? 00:00:00 /usr/sbin/httpd
 apache 1940 1932 0 05:02 ? 00:00:00 /usr/sbin/httpd
 root 1943 1438 0 05:02 pts/0 00:00:00 grep http

Where have I gone wrong?

share|improve this question
    
Can you check your logs in /var/log/httpd? There should be some details there about why Apache isn't starting properly - in particular the error.log file. –  Craig Watson May 17 '13 at 14:52
    
Thanks Flup. Found it ... –  giorgiolinux May 17 '13 at 15:31
    
sorry my post is gone ...[root@ip-xxxx logs]# getenforce Enforcing I set permissive and voilà, it works.Remains hard for me to understand that with bash before the selinux was bypassed –  giorgiolinux May 17 '13 at 15:35
    
If running with SeLinux, be careful about the context on manually created files. That can often cause issues. Those items will be logged into /var/log/messages (or secure). You can fix the context by either copying default files and then editing them or using chcon --reference=file filename to copy selinux contexts to a newly created file. –  jeffatrackaid May 17 '13 at 15:38
    
@giorgiolinux probably because there is a runuser somewhere in the LSB script, and your files are labeled incorrectly. Setting SELinux to permissive is not a solution –  dawud May 18 '13 at 10:11

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.