Apache Start, Stop and Restart: Commands and the graceful Difference

Test environmentRHEL familyAlmaLinux 9.8root accountChecked 2026-10-29

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.

taskRHEL family (httpd)Debian family (apache2)
Startsystemctl start httpdsystemctl start apache2
Stopsystemctl stop httpdsystemctl stop apache2
Restartsystemctl restart httpdsystemctl restart apache2
Reload configuration (graceful)systemctl reload httpdsystemctl reload apache2
Check statussystemctl status httpdsystemctl status apache2
Start automatically at bootsystemctl enable httpdsystemctl 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 apache2
Unit 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 httpd

start launches a stopped Apache. Use systemctl status to check that it started.

systemctl stop httpd

stop halts Apache. It does not accept web requests until you start it again.

systemctl restart httpd

restart 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 80

active (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 httpd
active

While 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 httpd
enabled

enabled 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=mixed

The 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.

🔁 What changes across the three ways to restart Apache
Explainer diagram
🔁 Command
$ systemctl restart httpdhttpd -k restartsystemctl reload httpd
① Parent process (Main PID)Goes down, then starts anewThe Main PID number changes.UnchangedReceives the HUP signal and rereads the configuration files.UnchangedReceives the USR1 signal and rereads the configuration files.
② Requests in progressFinished, then shut downThe stop is graceful-stop (WINCH), so requests in progress are finished.Cut off immediatelyTerminates the child processes at once and starts new children.Handled to the endEach child is replaced by a child with the new configuration as it finishes its request.
③ New incoming connectionsNot accepted until it is back upCloses the port while stopping.Handled once new children are upKeeps the port open and handles them once new children are up.Not droppedKeeps the port open so the operating system queues the connections.
systemctl restart httpd stops Apache and then starts it again, so the parent process itself starts anew and new connections cannot be accepted in between.
httpd -k restart sends a HUP signal to the parent process and ends the child processes immediately, so requests in progress are cut off.
systemctl reload httpd and apachectl graceful leave the parent process as it is and replace the child processes in the order their requests finish.

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 -t
Syntax OK

Running 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 httpd

Once 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.

Apache command simulatorRHEL-family httpd
[root@server work]#
Use the ↑↓ keys to recall commands you typed earlier.

🔢 FAQ & Recommended Content

Entering apachectl fullstatus on AlmaLinux 9 returned an error saying the fullstatus option is not supported (not supported), with exit code 2. The RHEL-family apachectl is a script installed in place of the apachectl that Apache ships, so it accepts only start, stop, restart, status, graceful, graceful-stop, configtest, -t and -v.

According to the httpd.service manual, the httpd unit is off (disabled) by default, and preset: disabled on the [Loaded] line of systemctl status is that default. Running systemctl enable httpd once makes it start at every boot, and adding --now to enable also starts it right away.

According to the httpd.service manual, running httpd directly from a root shell starts the service outside systemd, and default security restrictions such as SELinux are not applied. So start and stop it with systemctl or apachectl, and use the httpd command only for options that do not launch the service, such as the -t syntax check.

ℹ️ 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.

Leave a Reply

Your email address will not be published. Required fields are marked *

Prove your humanity: 2   +   4   =