How do you restart Apache?
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Ubuntu way:
to restart apche server:
Sudo service apache2 restart
for the way that’s borrowed from Red Hat.Do you want to restart Apache, or do you want to gracefully reload its configuration?
Everyone was answering the first question; you can do the second with
Gracefully reloading is a bit faster, and there’s no downtime.
There’s one caveat: if your apache config files contain an error (e.g. configures a log file in a directory that doesn’t exist), the server may silently exit without printing any error messages to the console. Most other errors are caught by the
apache2ctl configtest
thatservice apache2 reload
runs before doing the actual reload withapache2ctl graceful
.The recommended way under Ubuntu to start/stop services (not just Apache) is to use the start/stop/reload commands (which really are symbolic links to the initctl program, part of upstart).
For services that use the legacy
/etc/init.d
scripts, the corresponding script will be called with the correct parameters; for services that use the upstart infrastructure, the appropriate event transition will be signaled to the upstart daemon via initctl.So, to start/stop/reload/restart apache on Ubuntu, you can use: