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


  • 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. – user130370 Jan 8 '13 at 8:35

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.

  • 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

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 anybody 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.

  • The reason it complains about lynx (a command-line browser), is it needs it to display to output the results of apachectl fullstatus. It's a bit silly for it not to have a fallback, but there you are. You should be able to get lynx via aptitude if you want it. – AlexMA Aug 26 '14 at 16:35

I also faced the same issue, to fix this issue I need to enable server-status in httpd.conf file, as ./apachectl status command trying to connect server-status page which by default not configured

[root@bin]# ./apachectl status
                                   Not Found

   The requested URL /server-status was not found on this server.

[root@bin]# sh -x ./apachectl status
+ ACMD=status
+ ARGV=status
+ HTTPD=/usr/local/rail_apache/bin/httpd
+ test -f /usr/local/rail_apache/bin/envvars
+ . /usr/local/rail_apache/bin/envvars
++ test x '!=' x
++ LD_LIBRARY_PATH=/usr/local/rail_apache/lib
+ LYNX='links -dump'
+ STATUSURL=http://example.com:80/server-status
++ ulimit -H -n
+ ULIMIT_MAX_FILES='ulimit -S -n 4096'
+ '[' 'xulimit -S -n 4096' '!=' x ']'
+ ulimit -S -n 4096
+ '[' xstatus = x ']'
+ case $ACMD in
+ links -dump http://example.com:80/server-status
+ awk ' /process$/ { print; exit } { print } '
                                   Not Found

   The requested URL /server-status was not found on this server.
+ exit 0

  • Thanks for the analysis. I'm sure the OP would appreciate some more detail on just what to change in the Apache config to make mod_status work. – Felix Frank Aug 8 '14 at 9:36
  • you can add the following section in apache conf file to enable server-status <Location /server-status> SetHandler server-status Order deny,allow Allow from all </Location> – Skumar Aug 11 '14 at 5:31

If you had an same issue as below: + awk ' /process$/ { print; exit } { print } ' Not Found

The requested URL /server-status was not found on this server.

you need to fix it: 1. vim /sbin/apacheclt find STATUSURL="http://localhost:80/server-status" then change STATUSURL="http://localhost:80/" 2. restart apacheclt , it appear the content: [root@CentOS6-07 ~]# /sbin/apachectl status It works!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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