Categories: TutorialsUbuntu

How to check Apache status command in Linux

Apache is an open-source, cross-platform HTTP web server that is widely used to run web applications or websites. Apache is prevalent for its affordability and anyone can download and use it without any complex licensing issues. This massive popularity is fueled by a large user base who use Apache as their default web server software.

Apache is also extremely easy to use and the configuration process takes less effort than many of its competitors. You can learn the full setup process for the installation and configuration of Apache on Linux by clicking on our useful Apache command tips article.

Also read: How to use the “adduser” command in Linux with examples

In this article, we focus on the apache status command and how to effectively use it to understand and check Apache web server uptime on a Linux system. This is valuable information for any web developer who wants to get started with Apache.

Apachectl Command

The Apache HTTP server’s control interface is called apachectl. This method needs the mod_status module installed and activated, which allows it to show information on the server’s performance, including system uptime (which is the default setting).

Ubuntu

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

On RHEL/CentOS

To enable server-status components in RHEL/CentOS follow the steps below.

Step 1: Create a file using vi: /etc/httpd/conf.d/server-status.conf

Step 2: Add the following configuration


SetHandler server-status
#Require host localhost

Step 3: Save the file and restart Apache web server. You can use the following command for a quick restart.

# systemctl restart httpd

Step 4: Next install a command line web browser (lynx or links) if you do not have it already.

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

Step 5: And finally, run the following command to check the Apache service uptime

$ apachectl status

Alternatively, you can use the following command to view the Apache web server status information from a graphical web browser.

http://localhost/server-status

ps Command

Using the ps command, you can find a selection of the active processes running on a Linux system. You can use the following grep command to check Apache service uptime.

Note: Here are some useful grep commands that will come in handy.

-e – enables selection of processes on the system.
-o – is used to specify output.

# ps -eo comm,etime,user | grep apache2
# ps -eo comm,etime,user | grep root | grep apache2

The sample output below shows that apache2 service has been running for 9 minutes and 1 seconds. This is how long the apache server is online.

Systemctl Command

Systemctl is by far the most versatile command that allows users to control systemd system and service manager. You can also use it to start, restart, and stop services using the terminal.

Conclusion

In this article, we showed you three different ways to check Apache/HTTPD service uptime on a Linux system. Using the command anyone even with no prior knowledge in working with Apache services can get valuable insight into service uptime.

Ubuntu Server Admin

Recent Posts

Advantech AOM-2721 is now Ubuntu Certified

Canonical announces that the Advantech AOM-2721 is officially joining the list of Ubuntu Certified Hardware.…

4 hours ago

Ruby and Rails Performance Roundup: The Backlog Edition

Yet again instead of tweets, a blog post. The backlog got out of hand -…

4 hours ago

How to Deploy OpenProject on Ubuntu VPS

This article provides a guide demonstrating how to deploy OpenProject on Ubuntu VPS. What is…

4 hours ago

Canonical integrates NVIDIA Nemotron 3.5 Lightning with Ubuntu for always-on AI agents

Canonical is pleased to announce that  NVIDIA’s newly introduced NVIDIA Nemotron 3.5 Lightning, an open,…

2 days ago

Xfwl4’s Second Preview Release

I’m pleased to announce the second preview release of xfwl4, Xfce’s Wayland compositor, version 4.21.1.…

2 days ago

How to Install, Secure, and Set Up MySQL on Ubuntu 26.04 LTS

If you have been using an ecommerce store to place online orders or have been…

3 days ago