Home  »  ArticlesGuidesTechnologyTools   »   How to Check Apache Version on Ubuntu 20.04 Using Command Line

How to Check Apache Version on Ubuntu 20.04 Using Command Line

With a web server software as old as Apache, there tend to be situations where your installation falls behind current versions if not maintained properly. That is why you need to know how to check Apache version on Ubuntu.

Apache, free and open-source software is the most popular web server today. It was initially released in April 1995. The current stable release as of posting this article is Apache 2.4.51.

Written in C, it is a cross-platform web server and supports the major operating systems Linux, macOS, and Windows among a host of others.

Check Apache Version Using This

You should use the apache2 -v command-line option (in lower case) to check the current Apache version on Ubuntu. This command also works on other Debian-based Linux systems.

$ apache2 -v

With the following as output.

Server version: Apache/2.4.51 (Ubuntu)
Server built: 2021-10-07T19:17:14

This is not to be confused with the -V option, that is -V in upper case. The caps option is used to show compile settings and includes the version number too. You can check the output by running this command.

$ apache2 -V

This is an example of the partial output.

...

Server built: 2021-10-07T19:17:14
Server's Module Magic Number: 20120211:118
Server loaded: APR 1.7.0, APR-UTIL 1.6.1
Compiled using: APR 1.7.0, APR-UTIL 1.6.1
Architecture: 64-bit
Server MPM: event
threaded: yes (fixed thread count)
forked: yes (variable process count)
Server compiled with….

...

You can check other Apache command-line options using this.

$ apache2 -h

Which will give you the following output.

Usage: apache2 [-D name] [-d directory] [-f file]
               [-C "directive"] [-c "directive"]
               [-k start|restart|graceful|graceful-stop|stop]
               [-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S] [-X]
Options:
  -D name            : define a name for use in <IfDefine name> directives
  -d directory       : specify an alternate initial ServerRoot
  -f file            : specify an alternate ServerConfigFile
  -C "directive"     : process directive before reading config files
  -c "directive"     : process directive after reading config files
  -e level           : show startup errors of level (see LogLevel)
  -E file            : log startup errors to file
  -v                 : show version number
  -V                 : show compile settings
  -h                 : list available command line options (this page)
  -l                 : list compiled in modules
  -L                 : list available configuration directives
  -t -D DUMP_VHOSTS  : show parsed vhost settings
  -t -D DUMP_RUN_CFG : show parsed run settings
  -S                 : a synonym for -t -D DUMP_VHOSTS -D DUMP_RUN_CFG
  -t -D DUMP_MODULES : show all loaded modules
  -M                 : a synonym for -t -D DUMP_MODULES
  -t -D DUMP_INCLUDES: show all included configuration files
  -t                 : run syntax check for config files
  -T                 : start without DocumentRoot(s) check
  -X                 : debug mode (only one worker, do not detach)

Conclusion

For users on the CentOS, Fedora, and RHEL-based Linux systems, we have a related guide showing you how you can do the above on those systems.

Meanwhile, if you use Windows for your Apache needs we have you covered with this related guide.

Finally, in this beginner’s guide, you have seen how to use the command-line utility to check Apache version on Ubuntu and Debian-based systems. You have also learned how to access the Apache2 help interface for other options you may need in the future.

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.

Available under:
Articles, Guides, Technology, Tools