I switched from SLES to Ubuntu and now I want to restart my local server. In SLES I used :
but this somehow seems not to work in Ubuntu. :(
How do i restart my Apache?
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
sudo service apache2 reload
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 that
service apache2 reload runs before doing the actual reload with
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
So, to start/stop/reload/restart apache on Ubuntu, you can use:
sudo start apache2 sudo stop apache2 sudo reload apache2 sudo restart apache2
sudo /etc/init.d/apache2 restart
Of course you can swap out
start and (I think)
sudo service apache2 restart|stop|start
As Marius said graceful should be used either to restart:
sudo apache2ctl graceful
sudo apache2ctl graceful-stop
to stop Apache gracefully.
These commands wait until all requests for web pages have been served before restarting/stopping the web server so that your user's don't get half a web page.
First you check your status using this command
sudo service apache2 status
then stop the running service
sudo service apache2 stop
then use this command:
sudo /opt/lampp/lampp start
this solution has worked for me.
if you are install Apache 2.4 version in your system, to start restart or stop your Apache server on your local system,then you should run following command
or you can use restart, stop also as per your requirement. this is tested code
you can use services for restarting Apache
service apache2 restart
and you can use all functionality for it (Stop - Start - Reload)
if you are root: (In Ubuntu root is disabled, I think, than use 'sudo' command!)
$ /etc/init.d/apache stop $ /etc/init.d/apache start $ /etc/init.d/apache restart $ /etc/init.d/apache reload
(If you used a2ensite or a2dissite, you have to reload your apache configuration)
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?