The method
Connect to port 80 on the host and send it
HEAD / HTTP/1.0
This needs to be followed by carriage-return + line-feed twice
You'll get back something like this
HTTP/1.1 200 OK
Date: Fri, 03 Oct 2008 12:39:43 GMT
Server: Apache/2.2.9 (Ubuntu) DAV/2 SVN/1.5.0 PHP/5.2.6-1ubuntu4 with Suhosin-Patch mod_perl/2.0.4 Perl/v5.10.0
Last-Modified: Thu, 02 Aug 2007 20:50:09 GMT
ETag: "438118-197-436bd96872240"
Accept-Ranges: bytes
Content-Length: 407
Connection: close
Content-Type: text/html; charset=UTF-8
You can then extract the apache version from the Server: header
Typical tools you can use
You could use the HEAD utility which comes with a full install of Perl's LWP library, e.g.
HEAD http://your.webserver.com/
Or, use the curl utility, e.g.
curl --head http://your.webserver.com/
You could also use a browser extension which lets you view server headers, such as Live HTTP Headers or Firebug for Firefox, or Fiddler for IE
Stuck with Windows?
Finally. if you're on Windows, and have nothing else at your disposal, open a command prompt (Start Menu->Run, type "cmd" and press return), and then type this
telnet your.webserver.com 80
Then type (carefully, your characters won't be echoed back)
HEAD / HTTP/1.0
Press return twice and you'll see the server headers.
Other methods
As mentioned by cfeduke and Veynom, the server may be set to return limited information in the Server: header. Try and upload a PHP script to your host with this in it
<?php phpinfo() ?>
Request the page with a web browser and you should see the Apache version reported there.
You could also try and use PHPShell to have a poke around, try a command like
/usr/sbin/apache2 -V
The method
Connect to port 80 on the host and send it
HEAD / HTTP/1.0
This needs to be followed by carriage-return + line-feed twice
You'll get back something like this
HTTP/1.1 200 OK
Date: Fri, 03 Oct 2008 12:39:43 GMT
Server: Apache/2.2.9 (Ubuntu) DAV/2 SVN/1.5.0 PHP/5.2.6-1ubuntu4 with Suhosin-Patch mod_perl/2.0.4 Perl/v5.10.0
Last-Modified: Thu, 02 Aug 2007 20:50:09 GMT
ETag: "438118-197-436bd96872240"
Accept-Ranges: bytes
Content-Length: 407
Connection: close
Content-Type: text/html; charset=UTF-8
You can then extract the apache version from the Server: header
Typical tools you can use
You could use the HEAD utility which comes with a full install of Perl's LWP library, e.g.
HEAD http://your.webserver.com/
Or, use the curl utility, e.g.
curl --head http://your.webserver.com/
You could also use a browser extension which lets you view server headers, such as Live HTTP Headers or Firebug for Firefox, or Fiddler for IE
Stuck with Windows?
Finally. if you're on Windows, and have nothing else at your disposal, open a command prompt (Start Menu->Run, type "cmd" and press return), and then type this
telnet your.webserver.com 80
Then type (carefully, your characters won't be echoed back)
HEAD / HTTP/1.0
Press return twice and you'll see the server headers.
Other methods
As mentioned by cfeduke and Veynom, the server may be set to return limited information in the Server: header. Try and upload a PHP script to your host with this in it
<?php phpinfo() ?>
Request the page with a web browser and you should see the Apache version reported there.
You could also try and use PHPShell to have a poke around, try a command like
/usr/sbin/apache2 -V
httpd -v will give you the version of Apache running on your server (if you have SSH/shell access).
The output should be something like this:
Server version: Apache/2.2.3
Server built: Oct 20 2011 17:00:12
As has been suggested you can also do apachectl -v which will give you the same output, but will be supported by more flavours of Linux.
Videos
Why should I check my Apache version?
It is crucial to keep Apache updated to maintain security and ensure it is running optimally.
How often should I check my Apache version?
It is a good practice to check Apache version regularly or when you suspect any security vulnerabilities. It is also recommended to keep your software up to date for optimal security and reliability.
What is the easiest way to check Apache version?
Checking the Apache version through WHM is the easiest method for those who are not familiar with CLI. Simply navigate to Server Status > Apache Status, and you will have access to the current installed version of Apache.
The version will be published in the log specified under ErrorLog within your configuration. (/var/log/httpd/error_log is a standard location in many Linuxes.)
Additionally, you should be able to execute the httpd binary equivalent in windows with -v.
Example from Linux:
# /usr/local/apache/bin/httpd -v
Server version: Apache/1.3.41 (Unix)
Server built: Sep 10 2009 10:42:36
From CMD:
"C:\Program Files\[Apache directories]\bin\httpd.exe" -v
Example:
C:\Documents and Settings\User>"c:\Program Files\Apache Software Foundation\Apache2.2\bin\httpd.exe" -v
Server version: Apache/2.2.21 (Win32)
Server built: Sep 9 2011 10:26:10
You first need to find out where are those binaries stored. For this you may use the whereis command.
whereis httpd
The output will give you the different path for the files httpd like this:
httpd: /usr/sbin/httpd /usr/lib64/httpd /etc/httpd /usr/share/httpd /usr/share/man/man8/httpd.8.gz
Then, for the binaries, you can check the version using the path with the attribute -v
/usr/sbin/httpd -v
Output:
Server version: Apache/2.4.6 (CentOS)
Server built: Oct 19 2017 20:39:16
For the yum installed version, you may also use the following command:
sudo yum list installed httpd
Installed Packages
httpd.x86_64 2.4.6-67.el7.centos.6
Another last solution is to use: rpm -q httpd
You can check Apache Version in Ubuntu by using this Command -
apachectl -v
The Result will be like this -
vishal@vishal:~$ apachectl -v
Server version: Apache/2.4.41 (Ubuntu)
Server built: 2020-08-12T19:46:17