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.