Apache Start, Stop and Restart: Commands and the graceful Difference
On a Linux server, you start, stop and restart Apache with the systemctl command, and the service name is httpd on the RHEL family and apache2 on the Debian family. After reading the systemctl status output, the httpd unit file and the apachectl script on an AlmaLinux 9 server, we found that restart takes Apache down and brings it back up, while graceful keeps the parent process and only rereads the configuration.
Because stopping and restarting actually halt the service, we did not run start, stop or restart on the test server. Instead, we checked the behavior against the official Apache documentation, the httpd.service manual and the reload records left on the server. The host name, port number, times and request counts in the output below are example values.
1️⃣ Apache start, stop and restart commands
The Apache service name differs by distribution family. The RHEL family, such as RHEL, AlmaLinux and Rocky Linux, registers it with systemd as httpd, while Ubuntu and Debian register it as apache2.
| task | RHEL family (httpd) | Debian family (apache2) |
|---|---|---|
| Start | systemctl start httpd | systemctl start apache2 |
| Stop | systemctl stop httpd | systemctl stop apache2 |
| Restart | systemctl restart httpd | systemctl restart apache2 |
| Reload configuration (graceful) | systemctl reload httpd | systemctl reload apache2 |
| Check status | systemctl status httpd | systemctl status apache2 |
| Start automatically at boot | systemctl enable httpd | systemctl enable apache2 |
Run the commands in the table as root. From a regular account, put sudo in front of the command.
If you mix up the families and use the other name, the command does not run. Asking for the status with apache2 on a RHEL-family server returned an error saying the unit could not be found.
systemctl status apache2Unit apache2.service could not be found.The exit code was 4, and changing the name to httpd on the same server produced normal output.
On the RHEL family, the three commands below start, stop and restart Apache.
systemctl start httpdstart launches a stopped Apache. Use systemctl status to check that it started.
systemctl stop httpdstop halts Apache. It does not accept web requests until you start it again.
systemctl restart httpdrestart runs stop and start in turn. If you only changed configuration files, apply them with reload (graceful), which does not drop connections.
On AlmaLinux 9, apachectl is a shell script installed in place of the apachectl that Apache ships. It passes start, stop, restart and status straight to systemctl, so apachectl restart and systemctl restart httpd do the same thing.
2️⃣ Check the Apache service status
Use systemctl status to see whether Apache is running now and when it started.
systemctl status httpd● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; preset: disabled)
Active: active (running) since Sat 2026-10-17 08:30:49 UTC; 1 week 4 days ago
Docs: man:httpd.service(8)
Process: 2930107 ExecReload=/usr/sbin/httpd $OPTIONS -k graceful (code=exited, status=0/SUCCESS)
Main PID: 741 (httpd)
Status: "Total requests: 52418; Idle/Busy workers 75/0;Requests/sec: 0.0528; Bytes served/sec: 3.9KB/sec"
Tasks: 224 (limit: 4615)
Memory: 184.3M (peak: 593.8M)
CPU: 47min 33.944s
CGroup: /system.slice/httpd.service
├─ 741 /usr/sbin/httpd -DFOREGROUND
├─2930111 /usr/sbin/httpd -DFOREGROUND
├─2930143 /usr/sbin/httpd -DFOREGROUND
└─2930144 /usr/sbin/httpd -DFOREGROUND
Oct 28 15:00:00 server systemd[1]: Reloading The Apache HTTP Server...
Oct 28 15:00:00 server systemd[1]: Reloaded The Apache HTTP Server.
Oct 28 15:00:00 server httpd[741]: Server configured, listening on: port 80active (running) on the [Active] line means it is running now, and the time after since is when it started. This server started 11 days earlier and never stopped, and [Main PID] 741 was the parent process launched at that time.
Under [CGroup], the entries listed below 741 are child processes that actually handle requests (see Processes). The [Status] line shows the number of requests handled so far and the numbers of idle and busy workers.
The three log lines at the bottom of the output were reload records left once a day at the same time. They show that logrotate, which splits logs by date, ran systemctl reload httpd after finishing the rotation, and the httpd.service manual also states that httpd is reloaded after logrotate.
Scripts and check commands use is-active and is-enabled, which print a single word.
systemctl is-active httpdactiveWhile it was running, the result was active with exit code 0. Even apache2, which does not exist on the server, returned inactive with exit code 3, the same as a stopped service, so in scripts, check first that the service name is correct.
systemctl is-enabled httpdenabledenabled means Apache is registered to start automatically at boot.
3️⃣ Apache restart vs graceful
restart and graceful (reload) differ in how they handle requests in progress and the parent process. We first checked the difference in the lines of the httpd unit file used for reload and stop.
systemctl cat httpd | grep -E "Exec|Kill"ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND
ExecReload=/usr/sbin/httpd $OPTIONS -k graceful
KillSignal=SIGWINCH
KillMode=mixedThe ExecReload line means that reload runs httpd -k graceful, and the KillSignal line means that the signal sent on stop is SIGWINCH (graceful-stop).
So systemctl restart httpd stops Apache with graceful-stop and then starts it again. Requests in progress are finished before it goes down, but the parent process itself starts anew, so the [Main PID] number changes. Between the stop and the start, the port is closed and new connections are not accepted. The apache2.service unit file in the Debian package also runs apachectl graceful-stop when stopping.
httpd -k restart sends a HUP signal to the parent process. According to the official Apache documentation, the parent stays but the child processes are terminated immediately, so requests in progress are cut off and the request statistics are reset to 0.
graceful sends a USR1 signal to the parent process. The parent rereads the configuration files, and each child process is replaced by a child with the new configuration as soon as it finishes the request it was handling. Connections that arrive in the meantime are queued by the operating system, so they are not lost.
It is like a shop that stays open while each cashier, after finishing with the current customer, hands over to a colleague on the new shift schedule.
We confirmed this difference with the Main PID. Even though reload ran every day, Main PID 741 and the Active time were unchanged from 11 days earlier, and the child process numbers (2930111 and so on) came right after 2930107 on the [Process] line of the last reload.
systemctl reload httpd, apachectl graceful and httpd -k graceful are all the same graceful. On AlmaLinux 9, apachectl sends SIGUSR1 to the parent process with systemctl kill when it receives graceful, and apachectl -k graceful, with -k in front, drops the -k and does the same thing.
graceful only rereads the configuration, so it is not suitable after updating the httpd package. According to the httpd.service manual, reload is not safe if an updated module uses a feature that exists only in the new httpd, so when the httpd package is updated, it restarts Apache automatically with systemctl try-restart.
4️⃣ Check the Apache configuration syntax
Even if you apply changes with graceful to keep connections open, Apache does not switch to the new configuration if a configuration file has a typo. According to the official Apache documentation, restart and graceful run a syntax check before executing, and if there is an error, they only print an error message and do not restart.
So after editing the configuration, check the syntax first with apachectl -t.
apachectl -tSyntax OKRunning apachectl -t printed a single Syntax OK line, and running apachectl configtest gave the same result. The RHEL-family apachectl runs httpd -t as is when it receives -t.
Checking a test configuration file with one misspelled directive name returned, instead of Syntax OK, an AH00526 error showing which line it was on and which directive was not recognized ([Invalid command 'DirectoryIndx']), with exit code 1. Fix the line shown in the error message and check again.
systemctl reload httpdOnce the check passes, apply the configuration with reload. According to the official Apache documentation, the syntax check looks only at syntax, so applying the configuration can still fail even after it passes. After reload, check the [Active] line of systemctl status and the logs at the bottom once more.
🔲 Apache command simulator
On the virtual server in the simulator below, you can type systemctl, apachectl and httpd -k commands yourself. After reload, the Main PID stays the same and only the child process numbers change. After restart, even the Main PID changes to a new number.
🔢 FAQ & Recommended Content
Apache · Restart error
Apache restart error | (20014)Internal error: Error retrieving pid file logs/httpd.pid
Why commands such as apachectl restart produce a pid file error, and the steps to clean up an empty httpd.pid.
Apache · php-fpm
php-fpm max_children warning: find the cause in the logs before adding workers
A record of using logs to find why max_children warnings piled up on a WordPress server running Nginx, Apache and php-fpm.
ℹ️ Affiliate Disclosure
This site's content contains affiliate links. When a visitor buys a product or service through one of them, the site receives a commission from the seller. The amount the buyer pays(it goes down during event discounts ↓)does not go up. Posted prices, discounts, and stock reflect the time of writing and may differ, so confirm with the seller before buying. Products are chosen and reviewed by our own standards, and commissions do not affect the order or content of reviews.