Проверить версию apache linux

How can I tell what version of apache I’m running?

I know about the phpinfo() way but is there any other way? I’m using CentOS and I can’t find the httpd executable to run httpd -v .

6 Answers 6

Either rpm -q httpd or /usr/sbin/httpd -v should work.

Thanks! I kept looking in /sbin instead of /usr/sbin but both of those worked! Hopefully Google will index this answer instead of the garbage that is out there.

@tooshel: You could have tried locate. «locate bin/httpd». Assuming it’s installed, not sure it’s standard on CentOS.

Yeah, we do have locate . . . I found out because another colleague was convinced I didn’t move something because the «locate» index was not updated. I still always forget it’s there! Thanks!

This does not work. It only figures out the apache version on the harddisk. Not the currently running one.

For recent Apache versions, try this:

The output should be something like this:

Server version: Apache/2.4.7 (Ubuntu) Server built: Jul 24 2015 17:25:11 

Run this command in your console:

Output should be something like:

Server version: Apache/2.4.7 (Ubuntu) Server built: Jan 14 2016 17:45:23 

The result will look like this :

Server version: Apache/2.4.5 (CentOS) Server built: Aug 2 2019 10:41:15 

Welcome to the site. Your answer seems rather similar to what @jsbillings proposed; would you mind to add some explanation on where your approach differs or what new aspect it tackles?

The above check only includes the primary version number, not including the extended backport patches.

If you installed with yum you can:

and get the full version (note the -31 / -47)

Installed Packages httpd.x86_64 2.2.15-31.el6.centos Available Packages httpd.x86_64 2.2.15-47.el6.centos

port list apache2 apache2 @2.4.28 www/apache2 

You must log in to answer this question.

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.7.14.43533

Читайте также:  Virtualbox guest additions linux debian

Linux is a registered trademark of Linus Torvalds. UNIX is a registered trademark of The Open Group.
This site is not affiliated with Linus Torvalds or The Open Group in any way.

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

Полезные команды для управления веб-сервером Apache в Linux

В этом руководстве мы опишем некоторые из наиболее часто используемых команд управления службами Apache (HTTPD), которые вы должны знать как разработчик или системный администратор, и вы должны держать эти команды под рукой. Мы покажем команды как для Systemd, так и для SysVinit.

Убедитесь, что следующие команды должны выполняться от имени пользователя root или sudo и должны работать с любым дистрибутивом Linux, таким как CentOS, RHEL, Fedora Debian и Ubuntu.

Установить сервер Apache

Чтобы установить веб-сервер Apache, используйте менеджер пакетов дистрибутива по умолчанию, как показано ниже.

$ 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 в вашей системе Linux, выполните следующую команду.

$ sudo httpd -v OR $ sudo apache2 -v
Пример вывода
Server version: Apache/2.4.6 (CentOS) Server built: Nov 5 2018 01:47:09

Если вы хотите отобразить номер версии Apache и параметры компиляции, используйте флаг -V , как показано ниже.

$ sudo httpd -V OR $ sudo apache2 -V
Пример вывода
Server version: Apache/2.4.6 (CentOS) Server built: Nov 5 2018 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 на наличие синтаксических ошибок, выполните следующую команду, которая проверит правильность файлов конфигурации перед перезапуском службы.

$ sudo httpd -t OR $ sudo apache2ctl -t
Пример вывода
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using linux-console.net. Set the 'ServerName' directive globally to suppress this message Syntax OK

Запустить службу Apache

Чтобы запустить службу 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

Чтобы перезапустить 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

Чтобы остановить службу 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

И последнее, но не менее важное: вы можете получить справку о командах службы Apache в systemd, выполнив следующую команду.

$ sudo httpd -h OR $ sudo apache2 -h OR $ systemctl -h apache2
Пример вывода
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)

Дополнительную информацию о systemctl можно найти в статье Как управлять службами и модулями Systemd с помощью Systemctl в Linux.

Читайте также:  Find differences in files linux

Вы также можете прочитать следующие статьи, связанные с Apache.

  1. 5 советов по повышению производительности веб-сервера Apache
  2. Как отслеживать загрузку веб-сервера Apache и статистику страниц
  3. Как администрировать веб-сервер Apache с помощью инструмента «Apache GUI»
  4. Как изменить HTTP-порт Apache в Linux
  5. 13 советов по безопасности и укреплению безопасности веб-сервера Apache
  6. Защитите Apache от атак грубой силы или DDoS-атак с помощью модулей Mod_Security и Mod_evasive

Это пока все! В этой статье мы объяснили наиболее часто используемые команды управления службами Apache/HTTPD, которые вам следует знать, включая запуск, включение, перезапуск и остановку Apache. Вы всегда можете связаться с нами через форму обратной связи ниже для любых вопросов или комментариев.

Источник

how to find out the apache version installed in ubuntu?

of course as mention by @karel you can also use apache2 instead of apachectl . just giving an alternative. This worked for me in Ubuntu 18.04 and I’m using Apache 2.4.37.

One is a lowercase v and the other is an uppercase V which could be different levels of verbosity for apachectl , but I can’t find any indication these flags exist in the manpage.

@Ali Çarıkçıoğlu, well for one thing karel’s solution didn’t work for me at all with Apache 2.2.22 (not pre-installed). Both solutions from god_is_love were very useful for me.

This solution also helped us (and the first didn’t). Admittedly, this isn’t on ubuntu 14.04, but the title didn’t disclose that, and we ended up here nonetheless.

if you have PHP installed with you apache2, you can find it in $_SERVER variable or with phpinfo() function:

'SERVER_SIGNATURE' => string '
Apache/2.4.29 (Ubuntu) Server …
'SERVER_SOFTWARE' => string 'Apache/2.4.29 (Ubuntu)' # and in phpinfo arrays: apache2handler Apache Version Apache/2.4.29 (Ubuntu)

You must log in to answer this question.

Hot Network Questions

Subscribe to RSS

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Читайте также:  Linux hard link у soft link

Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.7.14.43533

Ubuntu and the circle of friends logo are trade marks of Canonical Limited and are used under licence.

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

Оцените статью
Adblock
detector