Mac OS X: Restart / Stop / Start Apache2

How do I restart Apache 2 web server under Apple Mac OS X UNIX operating systems?

You need to use the apachectl command which nothing but a front end to the Apache 2 (HTTP) server. It is designed to help the administrator control the functioning of the Apache httpd daemon.

ADVERTISEMENTS

Open a terminal and use the following commands.

Task: Restart Apache2 Under Mac OS X

sudo apachectl -k restart

Sample session:

Fig.01: Restarting Apache 2 under Mac Os X Using command line

Fig.01: Restarting Apache 2 under Mac Os X Using command line options

The second command netstat -at | grep LISTEN verifies that port 80 (HTTP) is open and working fine.

Task: Stop Apache2 Under Mac OS X

sudo apachectl -k stop

Task: Start Apache2 Under Mac OS X

sudo apachectl -k start
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
2 comments… add one
  • Kumar Abinash Jul 25, 2015 @ 14:43

    What does the ‘-k’ stands for?

    • Brian Nov 4, 2015 @ 19:19

      -k tells to process to gracefully stop, start or restart

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.