nginx -v
或 httpd -v
;3. 查看运行进程(如ps aux | grep ‘nginx|httpd’),若Server信息被隐藏,需检查配置文件或服务状态确认。
在ECS(云服务器)中查看Web服务器类型是网站管理与维护的常见需求,无论是Apache、Nginx、IIS还是其他Web服务器,以下提供多种实用方法帮助访客快速获取信息,操作步骤均适用于Linux与Windows系统。
使用浏览器开发者工具
F12
进入开发者工具。 Network
(网络)选项卡,刷新页面后点击任意请求。 Response Headers
(响应头)中查找Server
字段, Server: nginx/1.18.0
注:部分服务器可能隐藏该字段以增强安全性。
通过命令行工具检测
curl -I 你的域名或IP地址
Invoke-WebRequest -Uri "你的域名或IP地址" -Method Head | Select-Object -ExpandProperty Headers
输出结果中的Server
即为Web服务器类型。
Nginx
/etc/nginx/nginx.conf
或/etc/nginx/sites-enabled/default
。 cat /etc/nginx/nginx.conf | grep "server_tokens"
若server_tokens
设置为off
,可能隐藏版本信息。
Apache
/etc/apache2/apache2.conf
(Linux)或httpd.conf
(Windows)。 ServerTokens
和ServerSignature
确认是否显示版本。IIS
通过服务器管理器进入IIS管理界面,查看站点属性中的服务器版本。
Linux系统
ps aux | grep -E 'nginx|apache|httpd'
输出结果会显示nginx
、apache
或httpd
进程。
Windows系统
nginx.exe
、httpd.exe
或w3wp.exe
(IIS)。若服务器支持PHP,可创建info.php
文件并写入以下内容:
<?php phpinfo(); ?>
访问该文件后,搜索SERVER_SOFTWARE
字段,
Apache/2.4.41 (Ubuntu)
访问以下工具网站,输入域名检测服务器信息:
Server
信息,可能是服务器配置了隐藏策略(如Nginx的server_tokens off
)。 root
或管理员权限。 参考资料