如何查看Debian机器上安装了Apache的哪个版本?
有这样做的命令吗?
如何查看Debian机器上安装了Apache的哪个版本?
有这样做的命令吗?
当前回答
或者,不那么直接地说:
nmap -A localhost -p
其他回答
我使用红帽Linux和以下命令工作:
httpd -V
当然,在shell中输入/usr/sbin/apache2 -v是最好和最快的方法,顺便说一下,这里还有另一种选择,以防你的服务器中也有PHP,你有兴趣在快速编程步骤中收集Apache版本(以及更多信息)。
在你的Apache web根文件夹(或任何你喜欢的文件夹)中创建一个info.php文件,并在里面写这些:
<?php
phpinfo();
?>
现在转到yoursite.com/info.php(或localhost/info.php用于本地计算机)。
你会在PHP变量部分看到你的Apache版本,这里有一个例子:
Phpinfo()示例转储页面
另外,请注意,这些步骤显然适用于任何与PHP集成的web服务器,所以它并不局限于Apache,一旦创建了页面,在开发时就可以方便地使用(只是不要忘记在生产环境中删除它!!)
对于更新的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....
工作在debian11靶心
/usr/sbin/apache2 -v
另一种方法是在基于debian的系统上检查包(包括Apache)安装的版本,我们可以使用:
apt-cache policy <package_name>
例如Apache
apt-cache policy apache2
它将显示如下内容(查看Installed行):
$ apt-cache policy apache2
apache2:
Installed: (none)
Candidate: 2.2.22-1ubuntu1.9
Version table:
2.2.22-1ubuntu1.9 0
500 http://hk.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
2.2.22-1ubuntu1 0
500 http://hk.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages