How to check apache httpd version in Linux?

How to Check Apache HTTPD Version in Linux

Direct Answer to the Question

To check the Apache HTTPD version in Linux, you can use the following methods:

  • Method 1: Using the httpd -v Command
  • Method 2: Using the apache2 -v Command (For Apache2)
  • Method 3: Using the cat /etc/apache2/apache2.conf Command (For Apache2)
  • Method 4: Using the apxs2 -q -v Command (For Apache 1.x)
  • Method 5: Using the /usr/sbin/httpd -v Command (For Apache 1.x)

Detailed Explanation of Each Method

Method 1: Using the httpd -v Command

The httpd command is used to verify the Apache HTTPD version. This method works on all versions of Apache HTTPD.

Steps:

  1. Open a terminal window on your Linux system.
  2. Type the command httpd -v and press Enter.
  3. You will see the version number of Apache HTTPD displayed on the screen.

Example:

$ httpd -v
Server version: Apache/2.4.7 (Unix)
Server Built: Apr 18 2018 14:46:14

Method 2: Using the apache2 -v Command (For Apache2)

This method is specifically for Apache2.

Steps:

  1. Open a terminal window on your Linux system.
  2. Type the command apache2 -v and press Enter.
  3. You will see the version number of Apache2 displayed on the screen.

Example:

$ apache2 -v
Apache/2.4.25 (Ubuntu)

Method 3: Using the cat /etc/apache2/apache2.conf Command (For Apache2)

This method is also specifically for Apache2.

Steps:

  1. Open a terminal window on your Linux system.
  2. Type the command cat /etc/apache2/apache2.conf and press Enter.
  3. The output will display the version number of Apache2 in the Apache configuration file.

Example:

$ cat /etc/apache2/apache2.conf
ServerRoot: "/usr/share/apache2"
ServerType: Apache/2.4.25

Method 4: Using the apxs2 -q -v Command (For Apache 1.x)

This method is specifically for Apache 1.x.

Steps:

  1. Open a terminal window on your Linux system.
  2. Type the command apxs2 -q -v and press Enter.
  3. You will see the version number of Apache 1.x displayed on the screen.

Example:

$ apxs2 -q -v
Apache/1.3.41 (Unix)

Method 5: Using the /usr/sbin/httpd -v Command (For Apache 1.x)

This method is also specifically for Apache 1.x.

Steps:

  1. Open a terminal window on your Linux system.
  2. Type the command /usr/sbin/httpd -v and press Enter.
  3. You will see the version number of Apache 1.x displayed on the screen.

Example:

$ /usr/sbin/httpd -v
Apache/1.3.41 (Unix)

Additional Tips and Tricks

  • Make sure you have the necessary permissions to run the commands.
  • If you are using a distribution-specific Apache package, you may need to use the distribution-specific commands (e.g., apt-cache show apache2 for Ubuntu-based systems).
  • The version numbers displayed may vary based on the version of Apache installed on your system.
  • You can also check the Apache version by looking at the /etc/httpd/conf/httpd.conf file (for Apache 1.x) or /etc/apache2/apache2.conf file (for Apache2).

Conclusion

In conclusion, checking the Apache HTTPD version in Linux is a straightforward process. By following the methods outlined in this article, you can easily determine the version of Apache HTTPD installed on your Linux system. Remember to use the correct commands for your version of Apache (e.g., httpd -v for Apache 2.x, apxs2 -q -v for Apache 1.x, etc.).

Unlock the Future: Watch Our Essential Tech Videos!


Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top