How to check Apache version in Linux, cPanel and WebHost Manager

Most of the websites we browse every day are probably using NGINX or the Apache HTTP Server. This is probably almost transparent for the final user, noticing almost no difference between the two.

But if you’re on the other side of the web, as you’re publishing or a server administrator, you probably are more involved in the technical aspects and need to know a little more about these things.

Whether you have to use some technology needing a specific version of apache, or an administrator checking if your server is affected by a security vulnerability, being able to check the apache version running on your server is a good skill to have at hand.

Let’s see how to do it!

Table of Contents

The quick answer from CLI

If you have access to the command line of your server, you can run the following command to get the apache version installed in your system:

apache2 -v

You’ll get something like the following output:

Server version: Apache/2.4.29 (Ubuntu)
Server built: 2022-03-16T16:53:42
Apache2 V Version Command Output

If this doesn’t work on your system, there’s another method you can try, keep reading and you’ll discover it in the CLI section below.

Now let’s dig a bit further to understand better what apache is and other methods to get the apache version if you don’t have access to a command line.

What is Apache HTTP server?

Apache is a free and open-source cross-platform software running mainly on web servers. It allows a browser on the client-side to connect to the server and get files and information from it.

Apache’s development started in 1995, when the world wide web was still in its early stages. This powerful web server software became the most popular HTTP server, helping the growth and expansion of the world wide web to how we know it today.

This great piece of software is still one of the most used HTTP servers, actually competing with NGINX. Some rankings show Apache as the most used, while others put NGINX on top, so there’s only a little difference in market share.

How does the Apache HTTP server work?

When a user requests a web page, the browser reaches the server hosting the site using the HTTP protocol. The server uses an HTTP server to handle the request and return a response with the requested file.

The Apache HTTP Server manages the connection, and delivers the service, ensuring that there are no errors and taking care of security aspects such as SSL encryption, some types of password authentication, and ensuring the client has the right authorizations to view the resource.

A great feature of Apache is its modularity. There are many modules that server administrators can enable and disable to turn on and off additional functionalities. Among these, we can find caching features, various encryption modes, URL rewriting, proxy features, error logging, virtual hosts, and many others you can find in this list from the apache documentation, where you can also get more info about all of them. All these external modules make Apache an extensible web server, with great potential for customization.

Checking the Apache version from a Linux command line

If you have access to a terminal or command-line interface on the server you want to check (for example if you have a dedicated cloud server) there are various methods to get the installed/running apache version. You can use the one you prefer, or chose based on the info you want to discover.

Using apache2 command

As we already stated in the quick answer section, you can check the apache version with the apache2 command:

apache2 -v

Using httpd command

If this doesn’t work, you can check the apache version also by using the httpd command. This is the process name of apache on an unix system. The syntax is easy and obvious if you’re a good Linux user, just use the -v option with httpd command:

httpd -v

The result will be similar to the one from the apache2 command we showed in the quick answer section.

If you want more info you can use the -V (with capital V) option to get a more detailed output (you’ll find an example of this output in the next paragraph).

Check with the apachectl control command

If none of these work or you need more info you can use the apachectl command. You can use the -v option to get normally the same output as the previous two commands, or you can use the -V (capital V) to get a little more info:

apachectl -V
Server version: Apache/2.4.29 (Ubuntu)
Server built:   2022-03-16T16:53:42
Server's Module Magic Number: 20120211:68
Server loaded:  APR 1.6.3, APR-UTIL 1.6.1
Compiled using: APR 1.6.3, APR-UTIL 1.6.1
Architecture:   64-bit
Server MPM:     event
  threaded:     yes (fixed thread count)
    forked:     yes (variable process count)
Server compiled with....
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=256
 -D HTTPD_ROOT="/etc/apache2"
 -D SUEXEC_BIN="/usr/lib/apache2/suexec"
 -D DEFAULT_PIDLOG="/var/run/apache2.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="mime.types"
 -D SERVER_CONFIG_FILE="apache2.conf"
Apachectl V Version Output

Using the dpkg command to get the installed packages

Alternatively, you can use the dpkg command to get a lot of info about all the apache packages installed in your system.

This is the command you have to run:

dpkg -l | grep -i apache2

You’ll probably get a result like the following one:

ii  apache2         2.4.29-1ubuntu4.22   amd64    Apache HTTP Server
ii  apache2-bin     2.4.29-1ubuntu4.22   amd64    Apache HTTP Server (modules and other binary files)
ii  apache2-data    2.4.29-1ubuntu4.22   all      Apache HTTP Server (common files)
ii  apache2-utils   2.4.29-1ubuntu4.22   amd64    Apache HTTP Server (utility programs for web servers)
Apache Version From Dpkg Output

Finding the Apache version from cPanel

If you have only access to the cPanel from your hosting service, you can find the Apache version info in the “General Information” -> “Server information” section.

Apache Cpanel Server Information

Checking the apache version from WebHost Manager (WHM)

If you have access to WHM (WebHost Manager) you can easily find the Apache version running on your server.

  • Go into the “Server Status” section on the left menu.
  • Click on the “Apache Status” menu option to open the details related to your apache server.
  • On the “Apache Status” page you’ll find the version info in the “Server version” section.