How To Find Out Apache Version Using Command

I have a rented dedicated LAMP solution stack server. I need to know what version of Apache I am running. How do I find out my Apache server version? How do I find out what modules loaded using command line option on Linux or Unix like operating systems?

This page explains how to check Apache version on Linux or Unix systems. The acronym LAMP refers the components of the solution stack composed entirely of free and open-source software as follows:
  • L for Linux operating systems
  • A for Apache http web server
  • M for MySQL or MariaDB database management server
  • P for PHP, Perl, or Python scripting languages
Tutorial details
Difficulty level Easy
Root privileges No
Requirements Apache web server on Linux or Unix
Est. reading time 5 mintues

How to Check the Apache Version

  1. Open terminal application on your Linux, Windows/WSL or macOS desktop.
  2. Login to remote server using the ssh command
  3. To see Apache version on a Debian/Ubuntu Linux, run:
    apache2 -v
  4. For CentOS/RHEL/Fedora Linux server, type command:
    httpd -v

You can locate apache2 or httpd path using the type command or command command. For instance:
type -a httpd
type -a apache2
whereis httpd
command -v httpd

How to tell what version of apache I'm running
Let us see all commands in details.

Finding out Apache (httpd) web server version command

The httpd is the Apache HyperText Transfer Protocol (HTTP) server program. In order to find out Apache version login to server using ssh or console. For example:
ssh user@ec2-server
Then once logged in type the following command to print the version of httpd, and then exit:
# httpd -v
Sample output from RHEL/CentOS server:

Server version: Apache/2.2.3
Server built:   Oct 28 2008 07:22:45

How to check the version of Apache on Debian/Ubuntu Linux

To show version number on Debian or Ubuntu Linux, type:
apache2 -v
Here is what I see:

Server version: Apache/2.4.41 (Ubuntu)
Server built:   2020-08-12T19:46:17

Output a list of modules compiled into the server:

We can list compiled in modules as follows
# httpd -l
# apache2 -l
This will not list dynamically loaded modules included using the LoadModule directive. To dump a list of loaded Static and Shared Modules:
# httpd -M
# apache2 -M
Sample output:

Loaded Modules:
 core_module (static)
 mpm_prefork_module (static)
 http_module (static)
 so_module (static)
 auth_basic_module (shared)
 auth_digest_module (shared)
 authn_file_module (shared)
 authn_alias_module (shared)
 authn_anon_module (shared)
 authn_dbm_module (shared)
 authn_default_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 authz_owner_module (shared)
 authz_groupfile_module (shared)
 authz_dbm_module (shared)
 authz_default_module (shared)
 ldap_module (shared)
 authnz_ldap_module (shared)
 include_module (shared)
 log_config_module (shared)
 logio_module (shared)
 env_module (shared)
 ext_filter_module (shared)
 mime_magic_module (shared)
 expires_module (shared)
 deflate_module (shared)
 headers_module (shared)
 usertrack_module (shared)
 setenvif_module (shared)
 mime_module (shared)
 dav_module (shared)
 status_module (shared)
 autoindex_module (shared)
 info_module (shared)
 dav_fs_module (shared)
 vhost_alias_module (shared)
 negotiation_module (shared)
 dir_module (shared)
 actions_module (shared)
 speling_module (shared)
 userdir_module (shared)
 alias_module (shared)
 rewrite_module (shared)
 proxy_module (shared)
 proxy_balancer_module (shared)
 proxy_ftp_module (shared)
 proxy_http_module (shared)
 proxy_connect_module (shared)
 cache_module (shared)
 suexec_module (shared)
 disk_cache_module (shared)
 file_cache_module (shared)
 mem_cache_module (shared)
 cgi_module (shared)
 version_module (shared)
 chroot_module (shared)
 perl_module (shared)
 php5_module (shared)
 proxy_ajp_module (shared)
 python_module (shared)
Syntax OK

Print the version and build parameters of httpd, and then exit

Type the command:
# httpd -V
Sample output:

Server version: Apache/2.2.3
Server built:   Oct 28 2008 07:22:45
Server's Module Magic Number: 20051115:3
Server loaded:  APR 1.2.7, APR-Util 1.2.7
Compiled using: APR 1.2.7, APR-Util 1.2.7
Architecture:   64-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D HTTPD_ROOT="/etc/httpd"
 -D SUEXEC_BIN="/usr/sbin/suexec"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="logs/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"

A note about package manager

One can use package manger too to dig out version info. For instance, on a Debian/Ubuntu Linux, I can type the following apt command:
apt info apache2
CentOS/RHEL/Fedora Linux user can type the following rpm command/dnf command/yum command:
rpm -q httpd
yum info httpd
dnf info httpd

Last metadata expiration check: 0:00:56 ago on Sat Jun 19 04:13:31 2021.
Installed Packages
Name         : httpd
Version      : 2.4.37
Release      : 39.module_el8.4.0+778+c970deab
Architecture : x86_64
Size         : 4.3 M
Source       : httpd-2.4.37-39.module_el8.4.0+778+c970deab.src.rpm
Repository   : @System
From repo    : appstream
Summary      : Apache HTTP Server
URL          :
License      : ASL 2.0
Description  : The Apache HTTP Server is a powerful, efficient, and extensible
             : web server.

Viewing Apache server config option

To view other configuration settings open httpd.conf file (usually located in /etc/httpd directory). Red hat, CentOS and Fedora stores httpd at the following location:
# vi /etc/httpd/conf/httpd.conf
Debian and Ubuntu stores httpd.conf in apache2.conf file at the following location:
# vi /etc/apache2/apache2.conf
FreeBSD stores apache2.2 configuration at the following location:
# vi /usr/local/etc/apache22/httpd.conf
If you made any changes to httpd.conf, check httpd syntax for error using the -t option:
# httpd -t
So if there are no errors, simply restart Apache web server. For example:
$ sudo systemctl status apache2 # Debian/Ubuntu
$ sudo systemctl status httpd # RHEL/CentOS

Summing up

Getting help is easy, run:
$ apache2 -h # Debian/Ubuntu
$ httpd -h # CentOS/RHEL/Fedora

Printing Apache 2 version on my Ubuntu Linux server

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 22 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
22 comments… add one
  • mhernandez Dec 20, 2008 @ 10:44

    Very complete post. I’ll keep it as a quick reference just in case i have to admin any of these systems.

  • n03x3c Dec 20, 2008 @ 15:27

    Good post. This is good to keep in quick ref. book…

  • Protocol Dec 20, 2008 @ 18:41

    You can also get some basic info if you telnet the server on port 80 and then type
    get / http/1.0

    It doesn’t tell you everything but you can get the basics.

  • Protocol Dec 20, 2008 @ 18:44

    Sorry, its

    head / http/1.0


  • Jeff Schroeder Dec 22, 2008 @ 14:15

    @The above post: If you don’t want an error message, do it like this:

    $ telnet 80
    HEAD / HTTP/1.1

    Jeff Schroeder

  • 🐧 nixCraft Dec 22, 2008 @ 15:49

    This is much easier for fingerprint remote web server
    curl -I

  • achmad Oct 27, 2009 @ 9:11

    hi, i am using apache version 2.2.3, before this the server is using public IP, then we decide to put it behind firewall and map the local IP. So, once we change the server’s IP address to local, we are unable to open the website, just the front page of apache. I think it was no issue with firewall because when we ping the public IP and can remote the server. Please help anyone…

  • Lee Murray Sep 23, 2010 @ 13:37

    good tutorials.

  • Toby Jan 21, 2011 @ 11:06

    Exactly what I was looking for, cheers!

  • Bipin Apr 23, 2011 @ 18:45

    Hi ,

    How can we check loaded modules version?

    Bipin Bahuguna

  • Troy Nov 7, 2011 @ 20:35

    This didn’t work for me, but

    apache2 -v


    • sredhar Dec 7, 2012 @ 11:10

      It is

      apachectl -v

  • Mkr Nov 30, 2011 @ 20:48

    Thanks, this post is extremely helpful

  • Max Jan 20, 2012 @ 14:34

    Thanks. Just what I needed.

  • TI Nov 21, 2012 @ 6:13

    The simple command helps me a lot. Thank you!

  • REM Jan 31, 2013 @ 21:17

    Actually, the very easiest way to determine what version of Apache you are running is to request a nonexistent page.

  • nickchacha Jun 8, 2013 @ 5:22

    Well done for newbies like i.

  • Eddie Oct 31, 2013 @ 3:50

    How to find out the VERSIONS of the loaded modules in Apache 2.x in CentOS 6.x is something that has been eluding me for a while. I don’t want to know which modules are loaded – I want their versions. HOW do I find out?

    • 🐧 nixCraft Nov 9, 2013 @ 5:54

      You can’t. Almost all modules are bundled and compiled for same version i.e. httpd version is 2.2.15 is same for all loaded modules.


  • Mevin Nov 21, 2014 @ 12:04

    I would like to know how to check the version of apache in hp-ux. Thank you.

  • Robert Oct 20, 2015 @ 16:03

    what if httpd is not in your path?

    • Jia Chuntao Jun 19, 2021 @ 4:05

      type -a httpd
      A list will be printed on screen:

      httpd is /usr/sbin/httpd
      httpd is /sbin/httpd

      Now run:
      /usr/sbin/httpd -v
      Finally version displayed:

      Server version: Apache/2.4.37 (centos)
      Server built:   May 20 2021 04:33:06

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum