如何查看Debian机器上安装了Apache的哪个版本?

有这样做的命令吗?


当前回答

或者,不那么直接地说:

nmap -A localhost -p

其他回答

You can use apachectl -V or apachectl -v. Both of them will return the Apache version information! xgqfrms:~/workspace $ apachectl -v Server version: Apache/2.4.7 (Ubuntu) Server built: Jul 15 2016 15:34:04 xgqfrms:~/workspace $ apachectl -V Server version: Apache/2.4.7 (Ubuntu) Server built: Jul 15 2016 15:34:04 Server's Module Magic Number: 20120211:27 Server loaded: APR 1.5.1-dev, APR-UTIL 1.5.3 Compiled using: APR 1.5.1-dev, APR-UTIL 1.5.3 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/apache2" -D SUEXEC_BIN="/usr/lib/apache2/suexec" -D DEFAULT_PIDLOG="/var/run/apache2.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="mime.types" -D SERVER_CONFIG_FILE="apache2.conf" You may be more like using apache2 -V or apache2 -v. It seems easier to remember! xgqfrms:~/workspace $ apache2 -v Server version: Apache/2.4.7 (Ubuntu) Server built: Jul 15 2016 15:34:04 xgqfrms:~/workspace $ apache2 -V Server version: Apache/2.4.7 (Ubuntu) Server built: Jul 15 2016 15:34:04 Server's Module Magic Number: 20120211:27 Server loaded: APR 1.5.1-dev, APR-UTIL 1.5.3 Compiled using: APR 1.5.1-dev, APR-UTIL 1.5.3 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/apache2" -D SUEXEC_BIN="/usr/lib/apache2/suexec" -D DEFAULT_PIDLOG="/var/run/apache2.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="mime.types" -D SERVER_CONFIG_FILE="apache2.conf"

用sudo试试

apachectl -V
-bash: apachectl: command not found

sudo apachectl -V
Server version: Apache/2.4.6 (Debian)
Server built:   Aug 12 2013 18:20:23
Server's Module Magic Number: 20120211:24
Server loaded:  APR 1.4.8, APR-UTIL 1.5.3
Compiled using: APR 1.4.8, APR-UTIL 1.5.2
Architecture:   32-bit
Server MPM:     prefork
  threaded:     no
  forked:     yes (variable process count)
Server compiled with....
bla bla....

该命令取决于您的Linux版本如何命名Apache Server。

在Debian和Mac OS上:

apachectl -v

在Red Hat和Amazon的EC2 Linux上使用:

httpd -v

在其他版本的Linux上尝试:

apache2 -v

你可以使用两种不同的标志:

-v # gives you the version number
-V # gives you the compile settings including version number.

如果你想在完整目录下运行命令,比如user3786265,但不知道你的apache位于哪里,使用whereis命令:

whereis httpd

试试apachectl -V:

$ apachectl -V
Server version: Apache/2.2.9 (Unix)
Server built:   Sep 18 2008 21:54:05
Server's Module Magic Number: 20051115:15
Server loaded:  APR 1.2.7, APR-Util 1.2.7
Compiled using: APR 1.2.7, APR-Util 1.2.7
... etc ...

如果不成功,请使用sudo命令运行该命令。

对我来说,这适用于Debian 6(挤压):

Linux www809 2.6.26-2-xen-686 #1 SMP Wed Sep 21 09:56:47 UTC 2011 i686 GNU/Linux

我必须走上正确的道路:

/usr/local/apache/bin** $ **./apachectl -v

./apachectl:第71行:ulimit:打开文件:不能修改limit:不允许操作 服务器版本:Apache/2.2.21 (Unix) 服务器构建:2011年12月17日19:57:53