How to Start, Stop, and Restart Apache on Linux

Apache is an open-source, cross-platform HTTP server widely used for hosting websites and web applications. Starting, stopping, restarting, and reloading the Apache service are among the most common tasks for developers and system administrators.
This guide explains how to manage the Apache service on Ubuntu, Debian, Fedora, RHEL, and their derivatives using systemctl
.
Quick Reference
On Ubuntu and Debian, the Apache service is named apache2. On Fedora, RHEL, and derivatives such as AlmaLinux and Rocky Linux, it is named httpd. Replace the service name with the one appropriate for your system.
| Action | Ubuntu/Debian | Fedora, RHEL, and Derivatives |
|---|---|---|
| Start | sudo systemctl start apache2 | sudo systemctl start httpd |
| Stop | sudo systemctl stop apache2 | sudo systemctl stop httpd |
| Restart | sudo systemctl restart apache2 | sudo systemctl restart httpd |
| Reload | sudo systemctl reload apache2 | sudo systemctl reload httpd |
| Status | sudo systemctl status apache2 | sudo systemctl status httpd |
| Enable on boot | sudo systemctl enable apache2 | sudo systemctl enable httpd |
| Disable on boot | sudo systemctl disable apache2 | sudo systemctl disable httpd |
| Test config | sudo apachectl configtest | sudo apachectl configtest |
Before You Begin
The commands in this guide require root or sudo privileges.
systemctl accepts the following arguments when managing the Apache service:
start— Starts the Apache service.stop— Terminates the Apache service.restart— Stops and then starts the Apache service. Active connections are dropped.reload— Reloads the configuration without dropping active connections. The main Apache process signals worker processes to finish their current requests, then restarts them with the new configuration.status— Shows the current service status, including whether it is running and recent log output.
Start, Stop, Restart, and Reload Apache on Ubuntu and Debian
On Ubuntu (26.04
, 22.04
, 20.04
, 18.04
) and Debian (10
, 9
), the Apache service is named apache2 and managed with systemctl.
To start the Apache service, run:
sudo systemctl start apache2To stop the Apache service, run:
sudo systemctl stop apache2To restart the Apache service (active connections are dropped), run:
sudo systemctl restart apache2To reload Apache after a configuration change without dropping active connections, run:
sudo systemctl reload apache2Use reload instead of restart when you only need to apply configuration changes on a production server with active clients.
To check the current status of the Apache service, run:
sudo systemctl status apache2● apache2.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; preset: enabled)
Active: active (running) since Sun 2026-03-01 14:00:00 UTC; 2h ago
Docs: https://httpd.apache.org/docs/2.4/
Main PID: 12346 (apache2)
Tasks: 55 (limit: 4915)
Memory: 12.4M
CGroup: /system.slice/apache2.service
├─12346 /usr/sbin/apache2 -k start
├─12347 /usr/sbin/apache2 -k start
└─12348 /usr/sbin/apache2 -k startEnable or Disable Apache on Boot
To configure Apache to start automatically when the system boots, run:
sudo systemctl enable apache2To prevent Apache from starting automatically on boot, run:
sudo systemctl disable apache2Start, Stop, Restart, and Reload Apache on Fedora, RHEL, and Derivatives
On Fedora, RHEL, and derivatives such as AlmaLinux and Rocky Linux, the Apache service is named httpd.
To start the Apache service, run:
sudo systemctl start httpdTo stop the Apache service, run:
sudo systemctl stop httpdTo restart the Apache service (active connections are dropped), run:
sudo systemctl restart httpdTo reload Apache after a configuration change without dropping active connections, run:
sudo systemctl reload httpdTo check the current status of the Apache service, run:
sudo systemctl status httpdTo enable Apache to start automatically on boot, run:
sudo systemctl enable httpdTo disable automatic startup on boot, run:
sudo systemctl disable httpdTest the Apache Configuration
Before restarting or reloading Apache, test the configuration for syntax errors with apachectl:
sudo apachectl configtestIf the configuration is valid, the output will show:
Syntax OKIf there are errors, the output will describe the problem along with the file path and line number. Fix all reported errors before reloading or restarting Apache to avoid bringing down the server with a broken configuration.
Troubleshooting
Apache fails to start after a configuration change
Run sudo apachectl configtest to check for syntax errors before starting. Review the error output to identify the file and line number causing the issue.
Port 80 or 443 is already in use
Another process may be listening on the port. Run sudo ss -tlnp | grep ':80' to identify it. Stop the conflicting process or configure Apache to use a different port in the virtual host configuration.
Unit apache2.service not found or Unit httpd.service not found
Apache may not be installed, or the service name is wrong for your distribution. Verify the correct service name with systemctl list-units --type=service | grep -i apache or httpd.
Failed to reload error
The configuration contains an error that prevents the reload. Run sudo apachectl configtest to identify and fix the issue before reloading.
Apache is running but not serving requests
Check the firewall rules. On Ubuntu/Debian, run sudo ufw status. On RHEL-based systems, run sudo firewall-cmd --list-all. Make sure port 80 (HTTP) and port 443 (HTTPS) are open.
Configuration changes are not taking effect
After editing any configuration file, run sudo systemctl reload apache2 (or httpd) to apply the changes without restarting.
FAQ
What is the difference between restart and reload?restart stops and starts the Apache process, which drops all active connections. reload signals the main Apache process to re-read the configuration files and gracefully restart worker processes without dropping active connections. Use reload for routine configuration changes on production servers.
How do I check if Apache is running?
Run sudo systemctl status apache2 on Ubuntu/Debian or sudo systemctl status httpd on RHEL-based systems. You can also run curl -I http://localhost to verify Apache is responding to HTTP requests.
How do I make Apache start automatically after a reboot?
Run sudo systemctl enable apache2 on Ubuntu/Debian or sudo systemctl enable httpd on RHEL-based systems. To confirm, run sudo systemctl is-enabled apache2 — it should output enabled.
Where are the Apache log files?
On Ubuntu/Debian, logs are stored in /var/log/apache2/ (access.log and error.log). On RHEL-based systems, logs are in /var/log/httpd/. Use journalctl
to view systemd service logs: sudo journalctl -u apache2.
Conclusion
You now know how to start, stop, restart, reload, and manage the Apache web server on Ubuntu, Debian, Fedora, and RHEL-based systems. Use reload instead of restart when applying configuration changes on production servers to avoid dropping active connections, and always run apachectl configtest first to catch errors before they take the server down.
For a full list of useful Apache commands, see the Apache Commands You Should Know guide.
If you have any questions, feel free to leave a comment below.
Tags
Linuxize Weekly Newsletter
A quick weekly roundup of new tutorials, news, and tips.
About the authors

Dejan Panovski
Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 800+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.
View author page