Terminal commands to start, stop or restart Apache Server on Mac OS

Terminal commands to start, stop or restart Apache Server on Mac OS

Whenever you edit '/etc/apache2/httpd.conf' file you need to restart apache on your mac. And you can make your life easy by using the terminal command to start, stop or restart the Apache server on Mac OX by simply executing the 'apachectl' commands.

 

Command to restart mac apache server

sudo apachectl restart

or

sudo /usr/sbin/apachectl restart

 

Command to start mac apache server:

sudo apachectl start

or

sudo /usr/sbin/apachectl start

Command to stop mac apache server:

sudo apachectl stop

or

sudo /usr/sbin/apachectl stop

 

And yes it's not always necessary to check what the status of Apache is, you can simply run the restart command from the terminal, without worrying about whether it is running or stopped.

The restart command is also very helpful if you make any changes related to your Apache server configuration in httpd.conf. And sometimes just restart the server before starting debugging why the website is not responding or something wrong with your Apache PHP setup.

Add new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
2 + 0 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.