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.
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).
Using the file /etc/apache2/mods-enabled/status.conf the server-status component is enabled by default.
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
Step 3: Save the file and restart Apache web server. You can use the following command for a quick restart.
Step 4: Next install a command line web browser (lynx or links) if you do not have it already.
Step 5: And finally, run the following command to check the Apache service uptime
Alternatively, you can use the following command to view the Apache web server status information from a graphical web browser.
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.
# 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 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.
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.
Previously I have written about how useful public cloud storage can be when starting a…
This is Part 2 of the "Karafka to Async Journey" series. Part 1 covered WaterDrop's…
For many software teams, documentation is written after features are built and design decisions have…
With the release of the FIPS 140-3 certified cryptographic modules for Ubuntu 22.04 LTS, Canonical…
Open source libraries are repositories of code that developers can use and, depending on the…
Last year, we had the opportunity to speak at Regent’s UX Conference (Regent’s University London’s…