I know of three ways to restart Apache:

sudo /usr/sbin/apachectl restart

sudo /etc/init.d/apache2 restart

service apache2 restart

What does each way do underneath?

I have also tried using service apache2 stop on Ubuntu, but it doesn't stop the server for some reason: localhost still serves on my desktop.

share|improve this question

service and/or init.d scripts are exactly the same thing as it runs same httpd script, that was meant mainly to stop and (re)start httpd service, while apachectl can do more (see output).

apachectl:

# apachectl 
Usage: /usr/sbin/httpd [-D name] [-d directory] [-f file]
                       [-C "directive"] [-c "directive"]
                       [-k start|restart|graceful|graceful-stop|stop]
                       [-v] [-V] [-h] [-l] [-L] [-t] [-S]
Options:
  -D name            : define a name for use in <IfDefine name> directives
  -d directory       : specify an alternate initial ServerRoot
  -f file            : specify an alternate ServerConfigFile
  -C "directive"     : process directive before reading config files
  -c "directive"     : process directive after reading config files
  -e level           : show startup errors of level (see LogLevel)
  -E file            : log startup errors to file
  -v                 : show version number
  -V                 : show compile settings
  -h                 : list available command line options (this page)
  -l                 : list compiled in modules
  -L                 : list available configuration directives
  -t -D DUMP_VHOSTS  : show parsed settings (currently only vhost settings)
  -S                 : a synonym for -t -D DUMP_VHOSTS
  -t -D DUMP_MODULES : show all loaded modules 
  -M                 : a synonym for -t -D DUMP_MODULES
  -t                 : run syntax check for config files
# 
share|improve this answer
    
ok reason im asking s because i used sudo /usr/sbin/apachectl restart and all my django static files now give 404 errors, thought it had something to do with the method of server reboot – Dr Manhattan Nov 19 '14 at 16:36

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.