Reading Time: 9 minutes

Apache HTTP Server is one of the most widely adopted web servers available, known for its reliability, flexibility, and extensive feature set. Whether you are a web developer, system administrator, or website owner, it's essential to understand the status of the Apache service running on your server.

Monitoring the service status helps you ensure that your website is up and running smoothly, identify and troubleshoot any issues, and take appropriate actions when necessary.

In this article, we will be reviewing the Apache service status. Sometimes checking the performance of a Cloud Dedicated Server can be difficult. Apache has a number of quite helpful built-in utilities that assist in monitoring the usage and performance of the web services it delivers.

Apache status also provides information that aids in operational auditing and control tuning. Explore the different ways to check the Apache service status and have visibility into the performance/health of your web server:

  1. Using the systemctl status command
  2. Using the apachectl status command
  3. Using server-status Module
  4. Using the systemctl status httpd.service -h help module

1. Using the systemctl status Command

Accessing the Apache status is rather easy. Suppose you are running a flavor of Linux with systemd as the initialization (init) system, such as Ubuntu 16.04 and above, CentOS 7 and above, or Fedora. In that case, you can use the systemctl status command to check the status of the Apache service.

To check the Apache status, you must SSH into the server as root, open your terminal, and then enter the following systemctl status httpd command at the command prompt:

[root@archlinux ~]# systemctl status httpd

1a. Issuing the systemctl status Command via cPanel

Running that command on a cPanel server will return data similar to the following. The output will provide detailed information about the Apache service, including whether it is running or stopped, the Process ID (PID), and recent log entries. Furthermore, you can check if the service is set to start at boot time:

[root@archlinux ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
 	Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; preset: disabled)
	Drop-In: /usr/lib/systemd/system/service.d
         	└─10-timeout-abort.conf
 	Active: active (running) since Thu 2023-06-22 16:12:59 CEST; 4min 49s ago
   	Docs: man:httpd.service(8)
   Main PID: 15105 (httpd)
 	Status: "Total requests: 0; Idle/Busy workers 100/0;Requests/sec: 0; Bytes served/sec:   0 B/sec"
  	Tasks: 177 (limit: 9180)
 	Memory: 18.8M
    	CPU: 286ms
 	CGroup: /system.slice/httpd.service
         	├─15105 /usr/sbin/httpd -DFOREGROUND
         	├─15106 /usr/sbin/httpd -DFOREGROUND
         	├─15108 /usr/sbin/httpd -DFOREGROUND
         	├─15109 /usr/sbin/httpd -DFOREGROUND
         	└─15114 /usr/sbin/httpd -DFOREGROUND


The descriptions of the fields shown above are as follows:

  • Loaded: This is the location for the configuration file.
  • Drop-In: This file defines the open file limit for Apache.
  • Active: This indicates that the service is active and running.
  • Docs: Relevant documentation.
  • Main PID: This is the main Apache Process ID.
  • Tasks: The overall number of tasks associated with the process.
  • Memory: The amount of memory the processes are using.
  • CPU: CPU information.
  • CGroup Block: This section denotes the control group of Apache child processes (including splitlogs in cPanel)

1b. Issuing the systemctl status Command via InterWorx

Running the systemctl status httpd.service command on an InterWorx server will return something similar to the following:

[root@host ~]# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/httpd.service.d
           └─limits.conf
   Active: active (running) since Fri 2019-10-04 13:16:37 EDT; 4 days ago
 Main PID: 68308 (httpd)
   Status: "Total requests: 3950; Idle/Busy workers 100/0;Requests/sec: 0.0109; Bytes served/sec:   6 B/sec"
   CGroup: /system.slice/httpd.service
           ├─43782 /usr/sbin/rotatelogs -l -f /home/user/var/domain.com/logs/error-ssl-%Y-%m-%d.log 86400
           ├─43784 /usr/sbin/rotatelogs -l -f /home/user/var/domain.com/logs/error-%Y-%m-%d.log 86400
           ├─43786 /usr/sbin/rotatelogs -l -f /home/user/var/domain.com/logs/transfer-ssl-%Y-%m-%d.log 86400
           ├─43787 /usr/sbin/rotatelogs -l -f /home/user/var/domain.com/logs/transfer-%Y-%m-%d.log 86400
           ├─43792 /usr/sbin/httpd -DSSL -DFOREGROUND
           ├─43819 /usr/sbin/fcgi- -DSSL -DFOREGROUND
           ├─43820 /usr/sbin/httpd -DSSL -DFOREGROUND
           ├─43821 /usr/sbin/httpd -DSSL -DFOREGROUND
           ├─43857 /usr/sbin/httpd -DSSL -DFOREGROUND
           ├─68308 /usr/sbin/httpd -DSSL -DFOREGROUND
           └─70722 /usr/sbin/httpd -DSSL -DFOREGROUND

Oct 04 13:16:37 host.domain.com systemd[1]: Starting The Apache HTTP Server...
Oct 04 13:16:37 host.domain.com systemd[1]: Started The Apache HTTP Server.
Oct 06 05:35:19 host.domain.com systemd[1]: Reloading The Apache HTTP Server.
Oct 06 05:35:19 host.domain.com systemd[1]: Reloaded The Apache HTTP Server.
[root@host ~]# 

The descriptions of the fields shown above are as follows:

  • Loaded: This is the location for the configuration file.
  • Drop-In: This file defines the open file limit for Apache.
  • Active: This indicates that the service is active and running.
  • Main PID: This is the primary Apache process ID.
  • Status: Status information.
  • CGroup Block: This section denotes the control group of Apache's child processes (including log rotation)

For more information about InterWorx vs. cPanel web admin tasks, including how to view the Apache server status page, refer to the following series of articles:

2. Using the apachectl status Command

An additional method that enables you to check the Apache status is by using the apachectl status command in your terminal. This command is typically available on most Apache installations and provides various options to manage and monitor the web server.

The apachectl status command is the forward-facing front end to the Apache HTTP Server. It is intended to help an admin control the functions of the Apache (httpd) daemon. The apachectl status script can function in two modes. First, it acts as a simple front-end to the httpd command that sets needed environment variables, which then invokes the httpd service, passing along any command-line arguments. Secondly, apachectl status acts as a SysV init processing script, using one-word arguments like start, restart, and stop, and translating them into appropriate commands to httpd.

The apachectl status command uses the following arguments to return information:

  • start: This argument starts the Apache httpd daemon.
  • stop: This argument stops the Apache httpd daemon.
  • restart: This argument restarts the Apache httpd daemon. If the service is not running, this command starts the https service. It also checks the configuration files before launching the service to ensure the service does not die.
  • fullstatus: This argument provides a full status report from mod_status. For this command to work, you need to have mod_status enabled on your server. A text-based browser such as Lynx can be used to view this info. See the How to Use httpd fullstatus to Monitor Apache article for more information.
  • status: This argument displays a short status report that is similar to the fullstatus argument, except that the list of http requests currently being served is not shown.
  • graceful: This argument gracefully restarts the httpd service. If the service is not running, it is started.
  • graceful-stop: This argument gracefully stops the Apache httpd service. This argument differs from a typical stop argument as it will leave connections open and not stop them.
  • configtest: This argument runs a configuration check on the http.conf file, and with either report, the syntax is ok, or it will provide detailed information about any syntax errors it finds.
  • atartssl: This argument starts the httpd service with SSL support enabled. This will require an edit to the config file to include the appropriate directives and then use the standard apachectl start.

In order to check the Apache service status using apachectl status, open your terminal and input the following command:

[root@archlinux ~]# apachectl status

The output will display the current status of the Apache service, including the server uptime, total requests processed, and the number of active connections. All of this information provides you with an overview of the resource utilization and the server's performance:

[root@archlinux ~]# apachectl status
● httpd.service - The Apache HTTP Server
 	Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; preset: disabled)
	Drop-In: /usr/lib/systemd/system/service.d
         	└─10-timeout-abort.conf
 	Active: active (running) since Thu 2023-06-22 16:12:59 CEST; 13min ago
   	Docs: man:httpd.service(8)
   Main PID: 15105 (httpd)
 	Status: "Total requests: 0; Idle/Busy workers 100/0;Requests/sec: 0; Bytes served/sec:   0 B/sec"
  	Tasks: 177 (limit: 9180)
 	Memory: 18.8M
    	CPU: 608ms
 	CGroup: /system.slice/httpd.service
         	├─15105 /usr/sbin/httpd -DFOREGROUND
         	├─15106 /usr/sbin/httpd -DFOREGROUND
         	├─15108 /usr/sbin/httpd -DFOREGROUND
         	├─15109 /usr/sbin/httpd -DFOREGROUND
         	└─15114 /usr/sbin/httpd -DFOREGROUND

Consider that the command may vary slightly according to the version of Apache installed on your machine. Make sure to use the appropriate command for your specific Apache version.

3. Using the server-status Module

In addition to the systemctl status and apachectl status commands, Apache provides other built-in options and modules that can assist in monitoring and managing the service status. The other option is the Apache server-status module.

By enabling this module in your Apache configuration, you can access a web-based interface that provides detailed, real-time information about the server's performance, current connections, and requests being processed. It is possible to configure your server-status page to provide you with the detailed overview most suitable for your monitoring needs.

To configure and use the server-status module, add the following lines of code to your Apache configuration file:

<Location "/server-status">
    SetHandler server-status
    Require ip 127.0.0.1
</Location>

After making the changes, restart the Apache service, and you can access the server-status page by visiting http://your-server-ip/server-status in a web browser.

4. Using the systemctl status httpd.service -h Help Module

The regular Apache status gives a solid amount of good information, but other Apache options provide more specific information. To view these options, we can run:

[root@archlinux ~]# systemctl status httpd.service -h

Issuing this command provides an output similar to the following:

[root@archlinux httpd.service.d]# systemctl status httpd.service -h
systemctl [OPTIONS...] {COMMAND} ...

Query or send control commands to the systemd manager.

  -h --help           Show this help
     --version        Show package version
     --system         Connect to system manager
  -H --host=[USER@]HOST
                      Operate on remote host
  -M --machine=CONTAINER
                      Operate on local container
  -t --type=TYPE      List units of a particular type
     --state=STATE    List units with particular LOAD or SUB or ACTIVE state
  -p --property=NAME  Show only properties by this name
  -a --all            Show all loaded units/properties, including dead/empty
                      ones. To list all units installed on the system, use
                      the 'list-unit-files' command instead.
  -l --full           Don't ellipsize unit names on output
  -r --recursive      Show unit list of host and local containers
     --reverse        Show reverse dependencies with 'list-dependencies'
     --job-mode=MODE  Specify how to deal with already queued jobs, when
                      queueing a new job
     --show-types     When showing sockets, explicitly show their type
  -i --ignore-inhibitors
                      When shutting down or sleeping, ignore inhibitors
     --kill-who=WHO   Who to send signal to
  -s --signal=SIGNAL  Which signal to send
     --now            Start or stop unit in addition to enabling or disabling it

This option provides information about all of the arguments available. While the Apache status and fullstatus commands may seem like an overwhelming amount of information, that information can assist in diagnosing many types of problems with Apache.

Apache Systemctl Status FAQs

1. What does the Apache service do?

Answer: The primary function of the Apache service is to handle incoming requests from clients, process them, and return the requested web pages or content to the clients. Once the users open a specific website or application, their browser sends a request to Apache, which gathers the requested data for them and then transmits it back to the user's browser.

Apache supports various protocols, including HTTP (Hypertext Transfer Protocol) and HTTPS (HTTP Secure), ensuring secure communication between the server and clients. It can handle different types of content, including static HTML pages, images, videos, CSS stylesheets, JavaScript files, and more.

2. What operating system does Apache run on?

Answer: One of the remarkable advantages of Apache is its ability to run on a wide range of operating systems. Whether using Linux, Windows, macOS, or Unix-like systems, Apache can be installed and configured to function efficiently. This cross-platform compatibility has contributed to its widespread adoption and made it accessible to a diverse user base.

3. Why do I need Apache?

Answer: Apache's popularity stems from its numerous benefits, which make it an essential component for website hosting and management. Five key reasons for using Apache are presented below.

  • Stability: Apache is known for its stability and robustness, ensuring your web server operates reliably without frequent crashes or disruptions. It has a proven track record of handling high-traffic loads and providing consistent performance.
  • Security: Apache strongly emphasizes security, incorporating features and mechanisms to protect against common vulnerabilities and threats. It supports Secure Sockets Layer (SSL)/Transport Layer Security (TLS) encryption for secure communication, provides access control mechanisms, and allows you to configure various security settings to safeguard your web applications.
  • Flexibility: Apache is highly customizable. It supports many modules and extensions, enabling you to extend its functionality and tailor it to your specific requirements. Additionally, Apache supports multiple scripting languages, such as PHP, Python, and Perl, allowing you to build dynamic and interactive websites.
  • Virtual Hosting: It is possible to host numerous domains on a single server when you take advantage of the benefits of virtual hosting. This feature is particularly beneficial for web hosting providers or businesses managing multiple websites, simplifying server management and resource allocation.
  • Community & Support: The Apache Software Foundation, the organization behind Apache, maintains extensive documentation and provides a vibrant community ecosystem. If you encounter any issues or have questions, refer to the official documentation, community forums, or mailing lists for guidance and support. Furthermore, numerous online resources and forums offer valuable insights, tips, and troubleshooting techniques related to Apache.

4. What's the difference between Apache and Tomcat?

While Apache is primarily a web server that delivers static content, Tomcat serves as a web container specifically designed for executing dynamic content, such as Java servlets and JavaServer Pages (JSPs). Apache and Tomcat are often used together to create a comprehensive web application hosting environment.

Apache acts as a front-end server, efficiently processing requests and handling static content. When a request involves dynamic content, Apache can pass it on to Tomcat, which specializes in executing Java-based web applications. This integration allows for the seamless execution of dynamic code and the efficient handling of requests that require dynamic processing.

5. What do I do if I have a problem? How do I get support?

If you encounter any issues with Apache, you can refer to the official Apache documentation, community forums, or mailing lists for assistance. Many online resources and forums also provide support and troubleshooting tips for Apache-related problems.

Bottom Line

Understanding the Apache service status is crucial for maintaining a reliable and efficient web server. By regularly monitoring the Apache status, you can quickly identify any issues, such as a service failure, high resource usage, or excessive connections, and take appropriate actions to resolve them. The different methods to check the Apache service status included using systemctl status, apachectl status, and enabling the server-status module. Each method provides valuable insights into the web server's health and performance, allowing you to ensure smooth operation and optimal user experience for your website visitors. We have found that using this technology can increase the speed and reliability of our HIPAA compliant hosting services.

If you're in need of a new hosting provider, check out our plans to get started today.

Liquid Web's Heroic Support is always available to assist customers in setting up this software or assisting with many other issues. If you need any assistance, please contact us on our Toll-Free number 1.800.580.4985 / International 517.322.0434, open a support ticket at support@liquidweb.com, or reach out via chat. We're standing by to help!

Original Publication Date

This article was originally published in October 2019. It has since been updated for accuracy and comprehensiveness.

Latest Articles

Controlling PHP settings with a custom php.ini file

Read Article

How to install Puppet Server on Linux (AlmaLinux)

Read Article

Email security best practices for using SPF, DKIM, and DMARC

Read Article

Linux dos2unix command syntax — removing hidden Windows characters from files

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article