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 -vCommand - Method 2: Using the
apache2 -vCommand (For Apache2) - Method 3: Using the
cat /etc/apache2/apache2.confCommand (For Apache2) - Method 4: Using the
apxs2 -q -vCommand (For Apache 1.x) - Method 5: Using the
/usr/sbin/httpd -vCommand (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:
- Open a terminal window on your Linux system.
- Type the command
httpd -vand press Enter. - 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:
- Open a terminal window on your Linux system.
- Type the command
apache2 -vand press Enter. - 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:
- Open a terminal window on your Linux system.
- Type the command
cat /etc/apache2/apache2.confand press Enter. - 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:
- Open a terminal window on your Linux system.
- Type the command
apxs2 -q -vand press Enter. - 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:
- Open a terminal window on your Linux system.
- Type the command
/usr/sbin/httpd -vand press Enter. - 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 apache2for 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.conffile (for Apache 1.x) or/etc/apache2/apache2.conffile (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.).
