昨天配置nginx的时候说道隐藏版本信息的问题,今天就罗列一下
要操作的信息列表
-
nginx版本信息查询及隐藏
-
Apache版本信息查询及隐藏
-
php版本信息查询及隐藏
-
tengine版本信息查询及隐藏
-
tomcat版本信息查询及隐藏
详细操作步骤
1.1、nginx版本信息查询
[[email protected]_nginx ~]# nginx -vnginx version: nginx/1.6.0
1.2、nginx编译配置参数查询
[[email protected]_nginx ~]# nginx -V
nginx version: nginx/1.6.0
built by gcc 4.4.7 20120313 (Red Hat4.4.7-4) (GCC) TLS SNI support enabledconfigure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module
--with-http_ssl_module --with-http_gzip_static_module --with-ipv6
1.3、客户端查看nginx的Response Header信息
[[email protected]_client ~]# curl -I HTTP/1.1 200 OKServer: nginx/1.6.0
Date: S at, 19 Jul 2014 02:18:54
GMTContent-Type: text/html
Content-Length: 16412
Last-Modified: Mon, 07 Jul 2014 05:25:22 G MT
Connection: keep-alive
Vary: Accept-Encoding
ETag: "53ba2f42-401c"
Accept-Ranges: bytes
1.4、如何隐藏nginx的Response Header中返回的版本号信息
-
修改nginx配置文件,在全局配置中添加server_tokens off; 这一行
-
[[email protected]_nginx ~]#
-
[[email protected]_nginx ~]# sed -n '/server_tokens/p' /usr/local/nginx/conf/nginx.conf
-
server_tokens off; # 在nginx全局配置文件中添加这行即可
-
[[email protected]_nginx ~]#
重启nginx服务然后客户端验证效果
-
[[email protected]_client ~]# curl -I http://218.244.xxx.xxx
-
HTTP/1.1 200 OK
-
Server: nginx
-
Date: Sat, 19 Jul 2014 02:33:11 GMT
-
Content-Type: text/html
-
Content-Length: 16412
-
Last-Modified: Mon, 07 Jul 2014 05:25:22 GMT
-
Connection: keep-alive
-
Vary: Accept-Encoding
-
ETag: "53ba2f42-401c"
-
Accept-Ranges: bytes
2、Apache版本信息查询及隐藏
2.1、apache版本信息查询
-
apache版本信息查询
-
[[email protected]_httpd ~]# apachectl -v
-
Server version: Apache/2.2.15 (Unix)
-
Server built: Apr 3 2014 23:56:16
-
[[email protected]_httpd ~]#
apache编译参数查询
-
[[email protected]_httpd ~]# apachectl -V
-
Server version: Apache/2.2.15 (Unix)
-
Server built: Apr 3 2014 23:56:16
-
Server's Module Magic Number: 20051115:25
-
Server loaded: APR 1.3.9, APR-Util 1.3.9
-
Compiled using: APR 1.3.9, APR-Util 1.3.9
-
Architecture: 64-bit
-
Server MPM: Prefork
-
threaded: no
-
forked: yes (variable process count)
-
Server compiled with....
-
-D APACHE_MPM_DIR="server/mpm/prefork"
-
-D APR_HAS_SENDFILE
-
-D APR_HAS_MMAP
-
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-
-D APR_USE_SYSVSEM_SERIALIZE
-
-D APR_USE_PTHREAD_SERIALIZE
-
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-
-D APR_HAS_OTHER_CHILD
-
-D AP_HAVE_RELIABLE_PIPED_LOGS
-
-D DYNAMIC_MODULE_LIMIT=128
-
-D HTTPD_ROOT="/etc/httpd"
-
-D SUEXEC_BIN="/usr/sbin/suexec"
-
-D DEFAULT_PIDLOG="run/httpd.pid"
-
-D DEFAULT_SCOREBOARD=
请发表评论