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

有这样做的命令吗?


当前回答

我认为您必须确定您有二进制文件或源文件的安装类型。 要检查安装了哪些二进制包:具有root权限执行以下命令:

dpkg -l |grep apache2

结果应该是这样的:

dpkg -l |grep apache2
ii  apache2                               2.4.10-10+deb8u8                      amd64        Apache HTTP Server
ii  apache2-bin                           2.4.10-10+deb8u8                      amd64        Apache HTTP Server (modules and other binary files)
ii  apache2-data                          2.4.10-10+deb8u8                      all          Apache HTTP Server (common files)
ii  apache2-doc                           2.4.10-10+deb8u8                      all          Apache HTTP Server (on-site documentation)

要查找版本,您可以运行:

apache2ctl -V |grep -i "Server version"

结果应该是这样的: 服务器版本:Apache/2.4.10 (Debian)

其他回答

工作在debian11靶心

/usr/sbin/apache2 -v

我尝试运行命令“httpd -V”和“apachectl -V”,但我无法执行,并得到错误:

-ksh: php: not found[没有这样的文件或目录]

然后我尝试了另一种方法。我进入服务器上的Apache目录,然后尝试执行命令:

./apachectl -v

这为我工作,并返回输出:

Server version: Apache/2.2.20 (Unix)
Server built:   Sep  6 2012 17:22:16

我希望这能有所帮助。

这适用于我的Debian:

$ /usr/sbin/apache2 -v

用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....

对我来说,这适用于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