如何确定网络服务器运行的是 Linux 还是 Windows?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10205870/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to determine if a webserver is running Linux or Windows?
提问by Zabs
I've been asked to find out if a particular site is running Windows or Linux as its webserver - usually we'd have access and I would just upload a phpinfo file and that would give me all the relevant information I need - however we've not been able to get access to FTP details yet.
我被要求查明某个特定站点是运行 Windows 还是 Linux 作为其网络服务器——通常我们可以访问,我只需上传一个 phpinfo 文件,它就会为我提供我需要的所有相关信息——但是我们'尚未能够访问 FTP 详细信息。
Is there a simple method using a Firefox plugin like Web Developer Toolbar that will indicate if the server is running Windows/Linux etc?
是否有使用 Firefox 插件(如 Web Developer Toolbar)的简单方法来指示服务器是否正在运行 Windows/Linux 等?
采纳答案by Eugene
Will not always work, but you can try typing in an address for the page that does not exist. If they don't have a custom 404 error, you may be able to see what it is.
并非总是有效,但您可以尝试为不存在的页面输入地址。如果他们没有自定义 404 错误,您也许能够看到它是什么。
回答by mti2935
You can usually get some pretty good clues by looking at the HTTP headers, which you can do using curl (with the -I flag). For example,
您通常可以通过查看 HTTP 标头获得一些很好的线索,您可以使用 curl(带有 -I 标志)来完成。例如,
$ curl -I www.microsoft.com
HTTP/1.1 200 OK
Cache-Control: private
Content-Length: 0
Server: Microsoft-IIS/8.0
P3P: CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM
INT NAV ONL PHY PRE PUR UNI"
X-AspNet-Version: 2.0.50727
VTag: 279958544400000000
X-Powered-By: ASP.NET
X-Powered-By: ARR/2.5
X-Powered-By: ASP.NET
Date: Fri, 20 Sep 2013 20:50:16 GMT
Note the line above that says Server: Microsoft-IIS/8.0
. By contrast, try:
请注意上面说Server: Microsoft-IIS/8.0
. 相比之下,尝试:
$ curl -I www.php.net
HTTP/1.1 200 OK
Date: Fri, 20 Sep 2013 20:53:05 GMT
Server: Apache/2.2.21 (FreeBSD) mod_ssl/2.2.21 OpenSSL/0.9.8q PHP/5.4.16-dev
X-Powered-By: PHP/5.4.16-dev
Content-language: en
Set-Cookie: COUNTRY=USA%2C173.203.108.101; expires=Fri, 27-Sep-2013 20:53:05 GMT; path=/;
domain=.php.net
Last-Modified: Sat, 21 Sep 2013 02:21:12 GMT
Vary: User-Agent,Accept-Encoding
Connection: close
Content-Type: text/html;charset=utf-8
and, it's pretty clear that this is a LAMP setup.
而且,很明显这是一个 LAMP 设置。
回答by Ari
You can get this and a lot of other information by using a technology profiler such as BuiltWith.
您可以通过使用诸如BuiltWith 之类的技术分析器来获取此信息和许多其他信息。
It also comes with a Chrome extension. It tells you the server, although as said by others, Apache can run both on Win and Linux.
它还带有一个Chrome 扩展程序。它告诉您服务器,尽管正如其他人所说,Apache 可以在 Win 和 Linux 上运行。