Table of Contents
回复内容:
Home Backend Development PHP Tutorial 如何判断一个网站用的Apache还是ngx?

如何判断一个网站用的Apache还是ngx?

Jun 06, 2016 pm 08:43 PM
apache nginx php

如何判断一个网站用的Apache还是ngx?通过哪些配置文件可以判断?

回复内容:

如何判断一个网站用的Apache还是ngx?通过哪些配置文件可以判断?

response header里有一个server字段可以判断

你们答案简单粗暴,但是遇到某些情况是没什么用的,例如:

lighttpd修改
setenv.add-response-header = ( "Server" => "SSHTTPd",
"X-Powered-By" => "SSPPP")

你们找到header的也不过是
Accept-Ranges:bytes
Content-Length:325
Content-Type:image/gif
Date:Wed, 03 Sep 2014 04:03:17 GMT
ETag:"692905520"
Last-Modified:Mon, 28 Oct 2013 05:17:31 GMT
Server:SSHTTPd
X-Powered-By:SSPPP

完全没什么用。

所以,我说一种方案:

XXX@A-PC:~$ nmap -sV XXX.XXX.XXX

Starting Nmap 6.40 ( http://nmap.org ) at 2014-09-06 05:59 CST
Nmap scan report for IP和域名隐藏了。。
Host is up (0.0049s latency).
Not shown: 999 filtered ports
PORT STATE SERVICE VERSION
80/tcp open http lighttpd

这个就很准确了。(用的也是修改过header的lighttpd)

当然如果他们铁下心要去修改源码来修改header,
那你们就从了吧。

打开浏览器-F12-打开URL

如何判断一个网站用的Apache还是ngx?

装个Wappalyzer,是个chrome的扩展,如果网站做了负载均衡的话,那就知道不了了

這個問題可以推廣到更普適的版本,那就是如何分辨任意網站背後的服務器程序。答案是沒有辦法。因爲服務器程序對用戶而言,做的是等價的工作,必然無法分辨。那麼狹隘一些,對於已知服務器程序類型,如何分辨?答案是,根據特性。

常見的特性有哪些?自然就是非標準的行爲,比如自定義的 HTTP 頭,Server 的返回值等等。但這些都可以僞造,因爲服務器程序的本質行爲都一樣,特性改成什麼樣,不影響。

所以,即便是對 Apache 和 ngx,普遍適用的判斷方法依舊不存在。

怎麼辦?根據具體問題具體分析,先收集二者的細微差異,提出假設,設計實驗驗證或推翻,逐步推倒出可能性更大的一種選擇。相信只要內部實現不同,在外部總能找到差異。

人肉打听一下这个网站是谁运维的,然后想办法去问他

chrome f12,点network,找到那个网页的记录,看返回头中的Server

我要是故意修改后,你能知道吗?

如果配置没改的话

$ curl -I http://segmentfault.com/q/1010000000659515
HTTP/1.1 200 OK
Server: ASERVER/1.2.9-3
Date: Sat, 06 Sep 2014 14:02:13 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
X-Powered-By: PHP/5.5.9-1ubuntu4.3
Set-Cookie: sfsess=dyOChB.f0350a50e8f6a4f3fe211ae191c835e6.a; expires=Sun, 07-Se
p-2014 14:02:12 GMT; Max-Age=86400; path=/; domain=segmentfault.com
X-Powered-By-Anquanbao: MISS from dxt-bj-sj-s91

Copy after login

不同的server的不同版本,http header 字段的排序有可能是不同的。

通过 HTTP Server 头是最简单的方法,不过这个头可以通过配置去掉。所以实际上没有精确的方法知道 web server 的类型。不过可以通过经验也就是统计方法。

参见:http://www.zhihu.com/question/21621809

chrome的话可以安装插件wappalyzer,网站使用的技术都可以显示出来

同意@大舒的看法

另: 如果nginx作为代理服务器分发到apache, 应该算什么?

传送门:ChromeSnifferPlus

想要得到最靠谱的答案: 去问人家。

从response里看的都是可以伪装的。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

To work on file upload we are going to use the form helper. Here, is an example for file upload.

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

CakePHP Creating Validators CakePHP Creating Validators Sep 10, 2024 pm 05:26 PM

Validator can be created by adding the following two lines in the controller.

CakePHP Quick Guide CakePHP Quick Guide Sep 10, 2024 pm 05:27 PM

CakePHP is an open source MVC framework. It makes developing, deploying and maintaining applications much easier. CakePHP has a number of libraries to reduce the overload of most common tasks.

CakePHP Logging CakePHP Logging Sep 10, 2024 pm 05:26 PM

Logging in CakePHP is a very easy task. You just have to use one function. You can log errors, exceptions, user activities, action taken by users, for any background process like cronjob. Logging data in CakePHP is easy. The log() function is provide

See all articles