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'm trying to move our production webserver over to a linux box. When I issue the start command using apachectl, nothing happens, and it goes back to the command line. If I run apachectl status, it tells me "ELinks: Connection refused".

However, if I try and start apache directly using httpd -k start, it starts the apache process just fine.

Any ideas as to why I can't use apachectl to start it? Also, is it a big deal to just start it by issuing the httpd -k start command? I would just always start it that way, but am worried about the following line from the apache documentation

In general, httpd should not be invoked directly, but rather should be invoked via apachectl on Unix-based systems

http://httpd.apache.org/docs/2.0/programs/httpd.html

share|improve this question
    
since you are using redhat ... try the follow command service httpd restart Also i would like a few more information to better assist you: How was your apache installed (with the system ? compiled by you ? with yum install httpd or apache) ? what do you have on the file /var/log/httpd/error_log ? please keep in mind that the most information you provided about your problem will help us help you faster. –  Prix Aug 24 '10 at 19:51
    
"ELinks: Connection refused" : Looks like your apachectl status is trying to use a text browser to parse server-status. –  Eric DANNIELOU Jan 8 '13 at 8:35
add comment

2 Answers 2

up vote 1 down vote accepted

What errors are you recieving from the apachectl command? apachectl is nothing more than a shell script, so you can debug it by invoking it with sh -x /path/to/apachectl start. You will see ALOT of information get spilled to the screen. If you aren't recieving any errors, or output and there are no httpd processes running on the system, you might want to look at your log files, such as /var/log/messages.

Additionally, after running the apachectl start command you could also issue echo $? to see the exit status code. These are all things that you could provide so that we can further help out.

share|improve this answer
    
It looks like SELinux was not allowing it to start.. But I would have never found that had you not mentioned the /var/log/messages file. Sorry for not initially posting more information / errors, but I really didn't have any.. Thanks for your help! –  Matt Aug 25 '10 at 18:54
    
No problem. Yeah, SELinux get's me everytime. I usually disabled that on every RHEL-based system; I personally do not use it. –  drewrockshard Aug 25 '10 at 21:14
add comment

For what its worth, I downloaded the Apache packages AFTER I installed the base Linux system. They compiled fine, but did not warn that the "links" package was missing.

  • so, make certain you have run "yum install links".

    Also, nothing was mentioned in the documentation about the difference between two similar looking files in different locations: "apachectl" in "/usr/local/apache2/bin/apachectl" and "/usr/sbin/apachectl". I ended up using the /usr/sbin/apachectl. "/usr/local/apache2/bin/apachectl" to this day still returns an error: "/usr/local/apache2/apachectl: line 94: lynx: command not found". No idea why. Apache's work with the "/usr/sbin/apachectl" version however.

  • [root@]# ls -l /usr/local/apache2/bin/apachectl -rwxr-xr-x. 1 root root 3428 Jan 27 12:11 /usr/local/apache2/bin/apachectl

  • [root@]# ls -l /usr/sbin/apachectl -rwxr-xr-x. 1 root root 3916 Dec 8 12:10 /usr/sbin/apachectl

I was stuck getting through all the intricacies of the file /etc/httpd/conf/httpd.conf. I'm all for web-security, but for clueless newbies like myself, its a bugger to have to wade into a plethora of Internet help files, like this one, to finally get a simple service to start.

For anybuddy else getting stuck in getting apachectl status to return a decent value - I bet you're also getting stuck where I was with the default values not being all that good in the /etc/httpd/conf/httpd.conf file. Uncomment and modify the appropriate sections. You may want to order Allow from all in the <Location /server-info> and <Location /server-status> points just to be sure your service is starting properly. Make sure to always restart the service with service httpd restart. Then, you can pare down access and return to Deny from all rules when you know your Apache server's running well.

share|improve this answer
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.