Apache is a famous free web server software that is utilized to serve websites and web applications. It is one of the most widely used web servers in the world and can run on a variety of operating systems, including Ubuntu. The Apache version in Ubuntu has several purposes, including “maintenance”, “compatibility”, “security”, “troubleshooting”, and many more.
This article will offer all possible methods to check which version of Apache is currently running in Ubuntu.
- Method 1: Using the “apache2” Command
- Method 2: Using the “type” Command
- Method 3: Using the “apt” Command
- Method 4: Using the “apachectl” Command
- Method 5: Using the “tail” Command
- Method 6: Using Web Browser (GUI)
Prerequisite: Ensure Apache is Installed
Before checking the version of Apache, users must ensure that Apache is installed in the operating system. If not installed, follow our article “How to Install Apache on Ubuntu 22.04?”
Method 1: Using the “apache2” Command
The “apache2” command is used to start and stop the Apache web server. To check the version of Apache running on the server, use the “apache2” command with the “v” option:
$ apache2 -v
The output displays the “2.4.52” version of Apache installed in the operating system.
Method 2: Using the “type” Command
Using the “type” command, find the full path of “Apache” in the Operating System. After that, use the extracted path such as “/usr/sbin/apache2” to check the version of Apache by executing the “v” option:
$ type -a apache2
$ /usr/sbin/apache2 -v
It displays the “2.4.52” version of Apache is currently installed in Ubuntu.
Method 3: Using the “apt” Command
To check the version of the installed “Apache” package/application, utilize the “apt” command with the “info” option by specifying the package name as “apache2”:
$ apt info apache2
The execution of the above command presents the “2.4.52-1ubuntu4.3” version of Apache installed in Ubuntu.
Method 4: Using the “apachectl” Command
The “apachectl” command is another utility for managing the Apache web server. To check the version of Apache, use the “apachectl” command with the “V” option:
$ apachectl -V
It displays the “2.4.52” version of Apache, as well as other information such as the server’s configuration file location and the compiled-in modules.
Method 5: Using the “tail” Command
The Apache error log may contain information about the version of Apache running on the server. To check the error log, use the “tail” command with the “f” option by specifying the path as “/var/log/apache2/error.log”:
$ tail -f /var/log/apache2/error.log
The output displays the error logs, which may include information about the Apache version as “2.4.52”.
Method 6: Using Web Browser (GUI)
The default Apache home page typically includes information about the server software and version. To check the home page, open a web browser and type the IP address such as “192.168.157.149”:
It displays the Apache home page by including information about the version of Apache running on the server which is “2”.
Note: To explore and configure Apache, follow our article link.
Conclusion
To check the version of Apache running on Ubuntu, use the “apache2”, “type”, “apt”, “apachectl”, and “tail” commands. The web browser can also provide Apache version information by entering the “server IP address/localhost” in the URL of the browser.
This guide has illustrated several methods to check the version of Apache in Ubuntu.