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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
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)

Hot Topics

Java Tutorial
1666
14
PHP Tutorial
1273
29
C# Tutorial
1255
24
The Compatibility of IIS and PHP: A Deep Dive The Compatibility of IIS and PHP: A Deep Dive Apr 22, 2025 am 12:01 AM

IIS and PHP are compatible and are implemented through FastCGI. 1.IIS forwards the .php file request to the FastCGI module through the configuration file. 2. The FastCGI module starts the PHP process to process requests to improve performance and stability. 3. In actual applications, you need to pay attention to configuration details, error debugging and performance optimization.

What happens if session_start() is called multiple times? What happens if session_start() is called multiple times? Apr 25, 2025 am 12:06 AM

Multiple calls to session_start() will result in warning messages and possible data overwrites. 1) PHP will issue a warning, prompting that the session has been started. 2) It may cause unexpected overwriting of session data. 3) Use session_status() to check the session status to avoid repeated calls.

NGINX and Apache: Understanding the Key Differences NGINX and Apache: Understanding the Key Differences Apr 26, 2025 am 12:01 AM

NGINX and Apache each have their own advantages and disadvantages, and the choice should be based on specific needs. 1.NGINX is suitable for high concurrency scenarios because of its asynchronous non-blocking architecture. 2. Apache is suitable for low-concurrency scenarios that require complex configurations, because of its modular design.

Composer: Aiding PHP Development Through AI Composer: Aiding PHP Development Through AI Apr 29, 2025 am 12:27 AM

AI can help optimize the use of Composer. Specific methods include: 1. Dependency management optimization: AI analyzes dependencies, recommends the best version combination, and reduces conflicts. 2. Automated code generation: AI generates composer.json files that conform to best practices. 3. Improve code quality: AI detects potential problems, provides optimization suggestions, and improves code quality. These methods are implemented through machine learning and natural language processing technologies to help developers improve efficiency and code quality.

Beyond the Hype: Assessing Apache's Current Role Beyond the Hype: Assessing Apache's Current Role Apr 21, 2025 am 12:14 AM

Apache remains important in today's technology ecosystem. 1) In the fields of web services and big data processing, ApacheHTTPServer, Kafka and Hadoop are still the first choice. 2) In the future, we need to pay attention to cloud nativeization, performance optimization and ecosystem simplification to maintain competitiveness.

What is the significance of the session_start() function? What is the significance of the session_start() function? May 03, 2025 am 12:18 AM

session_start()iscrucialinPHPformanagingusersessions.1)Itinitiatesanewsessionifnoneexists,2)resumesanexistingsession,and3)setsasessioncookieforcontinuityacrossrequests,enablingapplicationslikeuserauthenticationandpersonalizedcontent.

Using Apache: Building and Hosting Websites Using Apache: Building and Hosting Websites Apr 25, 2025 am 12:07 AM

Apache is an open source web server software that is widely used in website hosting. Installation steps: 1. Install using the command line on Ubuntu; 2. The configuration file is located in /etc/apache2/apache2.conf or /etc/httpd/conf/httpd.conf. Through module extensions, Apache supports static and dynamic content hosting, optimizes performance and security.

How to process and display percentage numbers in Java? How to process and display percentage numbers in Java? Apr 19, 2025 pm 10:48 PM

Display and processing of percentage numbers in Java In Java programming, the need to process and display percentage numbers is very common, for example, when processing Excel tables...

See all articles