3 Ways to Check Apache Server Status and Uptime in Linux

Apache is a world’s most popular, cross platform HTTP web server that is commonly used in Linux and Unix platforms to deploy and run web applications or websites. Importantly, it’s easy to install and has a simple configuration as well.

Read Also: How to Hide Apache Version Number and Other Sensitive Info

In this article, we will show how to check Apache web server uptime on a Linux system using different methods/commands explained below.

1. Systemctl Utility

Systemctl is a utility for controlling the systemd system and service manager; it is used it to start, restart, stop services and beyond. The systemctl status sub-command, as the name states is used to view the status of a service, you can use it for the above purpose like so:

$ sudo systemctl status apache2 #Debian/Ubuntu # systemctl status httpd #RHEL/CentOS/Fedora 

Check Apache Status Using Systemctl

2. Apachectl Utilities

Apachectl is a control interface for Apache HTTP server. This method requires the mod_status (which displays info about the server is performing including its uptime) module installed and enabled (which is the default setting).

On Debian/Ubuntu

The server-status component is enabled by default using the file /etc/apache2/mods-enabled/status.conf.

$ sudo vi /etc/apache2/mods-enabled/status.conf

Apache Mod_Status Configuration


To enable server-status component, create a file below.

# vi /etc/httpd/conf.d/server-status.conf

and add the following configuration.

<Location "/server-status">
SetHandler server-status
#Require host localhost #uncomment to only allow requests from localhost </Location>

Save the file and close it. Then restart the web server.

# systemctl restart httpd

If you are primarily using a terminal, then you also need a command line web browser such as lynx or links.

$ sudo apt install lynx #Debian/Ubuntu
# yum install links #RHEL/CentOS

Then run the command below to check the Apache service uptime:

$ apachectl status

Check Apache Status Using Apache2ctl

Alternatively, use the URL below to view the Apache web server status information from a graphical web browser:


3. ps Utility

ps is a utility which shows information concerning a selection of the active processes running on a Linux system, you can use it with grep command to check Apache service uptime as follows.

Here, the flag:

  • -e – enables selection of every processes on the system.
  • -o – is used to specify output (comm – command, etime – process execution time and user – process owner).
# ps -eo comm,etime,user | grep apache2
# ps -eo comm,etime,user | grep root | grep apache2
# ps -eo comm,etime,user | grep httpd
# ps -eo comm,etime,user | grep root | grep httpd

The sample output below shows that apache2 service has been running for 4 hours, 10 minutes and 28 seconds (only consider the one started by root).

Check Apache Uptime

Lastly, check out more useful Apache web server guides:

  1. 13 Apache Web Server Security and Hardening Tips
  2. How to Check Which Apache Modules are Enabled/Loaded in Linux
  3. 5 Tips to Boost the Performance of Your Apache Web Server
  4. How to Password Protect Web Directories in Apache Using .htaccess File

In this article, we showed you three different ways to check Apache/HTTPD service uptime on a Linux system. If you have any questions or thoughts to share, do that via the comment section below.

Spread the love

Posted by News Monkey