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

有这样做的命令吗?


当前回答

对我来说,apachectl -V不起作用,但apachectl fullstatus给了我我的版本。

其他回答

对于更新的Debian或Ubuntu发行版,应该使用apache2ctl -v或apache2 -v。

apache:/etc/apache2# apache2ctl -v
Server version: Apache/2.2.16 (Debian)
Server built:   May 12 2011 11:58:18

或者您可以使用apache2 -V获取更多信息。

apache2 -V
Server version: Apache/2.2.16 (Debian)
Server built:   May 12 2011 11:58:18
Server's Module Magic Number: x
Server loaded:  APR 1.4.2, APR-Util 1.3.9
Compiled using: APR 1.2.12, APR-Util 1.3.9
Architecture:   64-bit
Server MPM:     Worker
  threaded:     yes (fixed thread count)
    forked:     yes (variable process count)
Server compiled with....

用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

我使用红帽Linux和以下命令工作:

httpd -V

这适用于我的Debian:

$ /usr/sbin/apache2 -v