Посмотреть версию 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.

Читайте также:  Linux view files permissions

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

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

img

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

 Apache HTTPD

Убедитесь, что следующие команды должны выполняться от имени пользователя 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.

    Читайте также:  Linux cannot write to file

    Источник

    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.

    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.

    Читайте также:  Linux mint автозагрузка скрипта

    Источник

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