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.

Sponsored

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.

Sponsored
$ 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

Cut data center energy costs with bare metal automation

Data centers are popping up everywhere. With the rapid growth of AI, cloud services, streaming…

23 hours ago

Build the future of *craft: announcing Starcraft Bounties!

Our commitment to building a thriving open source community is stronger than ever. We believe…

23 hours ago

NodeJS 18 LTS EOL extended from April 2025 to May 2032 on Ubuntu

The clock was ticking: Node.js 18’s upstream End of Life (EOL) The OpenJS Foundation is…

23 hours ago

Native integration now available for Pure Storage and Canonical LXD

June 25th, 2025 – Canonical, the company behind Ubuntu, and Pure Storage, the IT pioneer…

2 days ago

Revolutionizing Web Page Creation: How Structured Content is Slashing Design and Development Time

Co-authored with Julie Muzina A year ago, during our Madrid Engineering Sprint, we challenged ourselves…

3 days ago

Ubuntu Weekly Newsletter Issue 897

Welcome to the Ubuntu Weekly Newsletter, Issue 897 for the week of June 15 –…

4 days ago