2 Methods of Checking Apache Version
As websites continue to become more complex and dynamic, the need for reliable web servers grows. Apache is one of the most widely used web servers in the world, powering millions of websites. Checking the version of Apache that you are using is an important task, as it can impact the security and functionality of your website. We will explore two methods of checking the Apache version.
What is Apache?
Before we go through the two methods of checking Apache versions, it is crucial to have a basic understanding of what Apache is. Apache is free, open-source web server software that runs on a wide range of operating systems. It was created by the Apache Software Foundation and has been in use since its initial release in 1995. Apache manages requests between clients/users and servers.
Apache is an HTTP server, meaning its primary purpose is to serve webpages and other files over the internet. It provides a reliable and efficient way to quickly process and deliver content to website users.
Apache web server is known for being stable, secure, and scalable. It is a popular choice for both private users and organizations looking for a reliable web server to host their website. It is also easily customizable with a wide range of modules available to help web developers adjust the server’s behavior to their needs. The Apache software comes with a module-based system, meaning that developers can add and remove the required components.
However, just like with any piece of software, it is mandatory to keep Apache updated, so you can be sure that you have all of the latest security updates. Keeping Apache updated will also make sure that you will not run into the various kinds of issues users were experiencing with the previous versions.
Method 1. Checking the Apache Version from CLI
There are multiple ways to check for Apache versions installed on your VPS, Cloud Dedicated Servers, and Dedicated Servers. Below are some of the most popular methods:
The output of the following command will display the current version of Apache installed on your system. Type the following command in your terminal and hit Enter.
This command will print out detailed information about the Apache httpd version installed on your system.
Entering the apachectl -v command is another way to check Apache version as shown below.
The command will display the Apache version installed on your system as well as the version of the OpenSSL library currently in use.
In some cases, the Apache version can be found within the Apache configuration file. The location of the configuration file may vary depending on the Linux distribution and installation method, but it is usually found in the /etc directory. Once inside the configuration file, look for a line with ServerTokens. This line will indicate the current server version and can be changed to expose more or less information.
Furthermore, you can run the RPM command. If your Apache installation was executed via RPM packages, you can use the following command to determine which Apache version is installed.
The command above will return the version of Apache installed on your system via RPM package.
If you are using Ubuntu, you can use the below apt-cache command to check Apache version.
This command will display information about the installed version of Apache HTTP Server as well as available versions in the Ubuntu repository.
Method 2. Checking the Apache Version from WHM
It is also possible to check Apache version from your Web Host Manager (WHM).
2. In the search bar, type Server Status and then click on Apache Status.
3. You will be able to locate the Apache version next to the Server Version on the Apache Status page.
Alternatively, you can check Apache version using the EasyApache 4 interface if you have access to it. Follow the next steps in order to check Apache version using the EasyApache 4 interface:
2. Navigate to Software and click on EasyApache 4.
3. Click on Customize profile, and then click on Next Step.
4. On the Apache MPM step, the Apache version will be displayed at the top of the page.
Depending on your WHM version, you can use Terminal within your WHM to check the current Apache version.
2. In the search bar type Terminal.
3. Open the Terminal and enter http -V command in order to check your Apache version.
Conclusion
Keeping Apache updated is essential to ensure the security and reliability of your website. In this article, we have discussed the two main methods you can use to check Apache version on your server through the CLI or the WHM.
The CLI method involves using a command-line interface to access your server and issue queries. This method is perfect for experienced users who are familiar with their servers.
The WHM method allows you to check the version of Apache through a Web Host Manager, even if you don’t have much experience with command-line interfaces. Simply access WHM and navigate to Server Status > Apache Status, and you will have access to the version of the software installed on your server.
Regardless of which method you prefer, regularly checking your Apache version is essential to protect your website from security risks and ensure that you will reduce the number of issues that could occur on your server.
Полезные команды для управления Apache в Linux
В этом руководстве мы опишем некоторые из наиболее часто используемых команд управления службами Apache (HTTPD) , которые полезно знать, разработчику или системному администратору, и держать эти команды под рукой. Мы покажем команды для Systemd и SysVinit.
Убедитесь, что следующие команды должны выполняться от имени пользователя root или sudo и работать с любым дистрибутивом Linux, таким как CentOS, RHEL, Fedora, Debian и Ubuntu.
Про Linux за 5 минут
Установка Apache Server
$ sudo apt install apache2 [On Debian/Ubuntu] $ sudo yum install httpd [On RHEL/CentOS] $ sudo dnf install httpd [On Fedora 22+] $ sudo zypper install apache2 [On openSUSE]
Проверка версии Apache
Чтобы проверить установленную версию вашего веб-сервера Apache в вашей системе Linux, выполните следующую команду.
Server version: Apache/2.4.6 (CentOS) Server built: May 5 2019 01:47:09
Если вы хотите увидеть номер версии Apache и параметры компиляции, используйте флаг -V, как показано ниже.
Server version: Apache/2.4.6 (CentOS) Server built: May 5 2019 01:47:09 Server's Module Magic Number: 20120211:24 Server loaded: APR 1.4.8, APR-UTIL 1.5.2 Compiled using: APR 1.4.8, APR-UTIL 1.5.2 Architecture: 64-bit Server MPM: prefork threaded: no forked: yes (variable process count) Server compiled with. -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D DYNAMIC_MODULE_LIMIT=256 -D HTTPD_ROOT="/etc/httpd" -D SUEXEC_BIN="/usr/sbin/suexec" -D DEFAULT_PIDLOG="/run/httpd/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf"
Проверка на ошибки синтаксиса конфигурации Apache
Чтобы проверить ваши файлы конфигурации Apache на наличие любых синтаксических ошибок, выполните следующую команду, которая проверит правильность файлов конфигурации, прежде чем перезапускать службу.
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using merionet.ru. Set the 'ServerName' directive globally to suppress this message Syntax OK
Запуск сервиса Apache
------------ On CentOS/RHEL ------------ $ sudo systemctl start httpd [On Systemd] $ sudo service httpd start [On SysVInit] ------------ On Ubunt/Debian ------------ $ sudo systemctl start apache2 [On Systemd] $ sudo service apache2 start [On SysVInit]
Включение службы Apache
Предыдущая команда пока только запускает службу Apache, чтобы включить автозапуск при загрузке системы, выполните следующую команду.
------------ On CentOS/RHEL ------------ $ sudo systemctl enable httpd [On Systemd] $ sudo chkconfig httpd on [On SysVInit] ------------ On Ubunt/Debian ------------ $ sudo systemctl enable apache2 [On Systemd] $ sudo chkconfig apache2 on [On SysVInit]
Перезапуск службы Apache
------------ On CentOS/RHEL ------------ $ sudo systemctl restart httpd [On Systemd] $ sudo service httpd restart [On SysVInit] ------------ On Ubunt/Debian ------------ $ sudo systemctl restart apache2 [On Systemd] $ sudo service apache2 restart [On SysVInit]
Просмотр состояния сервиса Apache
Чтобы проверить информацию о состоянии времени выполнения службы Apache, выполните следующую команду.
------------ On CentOS/RHEL ------------ $ sudo systemctl status httpd [On Systemd] $ sudo service httpd status [On SysVInit] ------------ On Ubunt/Debian ------------ $ sudo systemctl status apache2 [On Systemd] $ sudo service apache2 status [On SysVInit]
Перезагрузка сервиса Apache
Если вы внесли какие-либо изменения в конфигурацию сервера Apache, вы можете указать службе перезагрузить свою конфигурацию, выполнив следующую команду.
------------ On CentOS/RHEL ------------ $ sudo systemctl reload httpd [On Systemd] $ sudo service httpd reload [On SysVInit] ------------ On Ubunt/Debian ------------ $ sudo systemctl reload apache2 [On Systemd] $ sudo service apache2 reload [On SysVInit]
Остановка службы Apache
------------ On CentOS/RHEL ------------ $ sudo systemctl stop httpd [On Systemd] $ sudo service httpd stop [On SysVInit] ------------ On Ubunt/Debian ------------ $ sudo systemctl stop apache2 [On Systemd] $ sudo service apache2 stop [On SysVInit]
Показать справку Apache Command
И последнее, но не менее важное: вы можете получить справку о служебных командах Apache в systemd, выполнив следующую команду.
Usage: httpd [-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 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 : run syntax check for config files -T : start without DocumentRoot(s) check -X : debug mode (only one worker, do not detach)
На этом пока все! В этой статье мы объяснили наиболее часто используемые команды управления службами Apache / HTTPD, которые полезно будет знать, включая запуск, включение, перезапуск и остановку Apache.