The apachectl command act as Apache HTTP Server control interface. When you edit the Apache config file /etc/apache2/httpd.conf, you need to reload or restart the web server. Open the terminal application and type the following commands:
To stop Apache web server, enter:
sudo apachectl stop
OR
sudo apachectl -k stop
To start Apache web server again, enter:
sudo apachectl start
OR
sudo apachectl -k start
To restart apache web server, enter:
sudo apachectl restart
OR
sudo apachectl -k restart
To run a configuration file syntax test
sudo apachectl configtest
To reload apache web server after editing the config file
First edit the config file, run:
$ sudo vi /etc/apache2/httpd.conf
Make changes as per your needs. Close and save the file. To reload new changes, run:
sudo apachectl graceful
OR
sudo apachectl -k graceful
Sample session from above commands
Fig.01: apachectl in action on macOS
You can displays a brief status report by visiting the url http://localhost:80/server-status in the web browser of your choice.
🐧 Please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
- RSS feed or Weekly email newsletter
- Share on Twitter • Facebook • 6 comments... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
For some interesting reason, apache keeps spawning off new process however I kill it. I tried apachectl and kill -SIGTERM but apache would be killed and another process will be spawned right away.
Can you tell me why?
I have the same problem as you Antony.
I’ve used MAMP and then switched to Mac’s default Apache and problem still exists.
I think it is somehow related to xdebug. I’ll try zend_debugger. If that doesn’t work, I’m switching to another operating system.
in /Applications/XAMPP/xamppfiles/xampp include inicial line sudo apachectl stop
404-not found
could not be satisfied
Use this to stop the apache server
sudo /usr/sbin/apachectl stop
Thank you! I was tinkering around with the built-in Apache web server because I’ll be messing around with learning some HTML and CSS on my own. I found a page explaining how to start and use it, but it didn’t say how to end the process. I didn’t notice any performance change but I also didn’t want wayward processes running on my machine. Many thanks!