Hide version information of Lighttpd, Nginx, and Apache

Source: Internet
Author: User

The web server avoids unnecessary troubles and does not display apache and php version information.

Hide Apache version information

/Etc/apache2/apache2.conf or/etc/httpd/conf/httpd. conf

ServerTokens ProductOnly
ServerSignature Off

Restart apache
Now, only the following information is displayed in the http header:
Server: Apache

==================================

Nginx


# Vi nginx. conf
Add server_tokens off in http;

As follows:

Http {
...... Omitted Configuration
Sendfile on;
Tcp_nopush on;
Keepalive_timeout 65;
Tcp_nodelay on;
Server_tokens off;
....... Omitted Configuration
}

======================================

Hide PHP version
Php. ini

Expose_php On
Change
Expose_php Off

After apache is restarted, the php version is hidden in the http header.


===





Reference solution:

1. Lighttpd 1.4.20
Src/response. c: 108 changed:
Buffer_append_string_len (B, CONST_STR_LEN ("Server: jufukeji "));
Output Header:
HTTP/1.1 404 Not Found
Content-Type: text/html
Content-Length: 345
Date: Mon, 12 Jan 2009 13:54:02 GMT
Server: jufukeji

2. Nginx 0.7.30
Src/http/ngx_http_header_filter_module.c: 48-49 changed:
Static char ngx_http_server_string [] = "Server: jufukeji" CRLF;
Static char ngx_http_server_full_string [] = "Server: jufukeji" CRLF;
Output Header:
HTTP/1.1 200 OK
Server: jufukeji
Date: Mon, 12 Jan 2009 14:01:10 GMT
Content-Type: text/html
Content-Length: 151
Last-Modified: Mon, 12 Jan 2009 14:00:56 GMT
Connection: keep-alive
Accept-Ranges: bytes

3. Cherokee 0.11.6
Cherokee/version. c: 93 Add:
Ret = cherokee_buffer_add_str (buf, "jufukeji ");
Return ret;
Output Header:
HTTP/1.1 200 OK
Connection: Keep-Alive
Keep-Alive: timeout = 15
Date: Mon, 12 Jan 2009 14:54:39 GMT
Server: jufukeji
ETag: FIG = 703
Last-Modified: Mon, 12 Jan 2009 14:33:19 GMT
Content-Type: text/html
Content-Length: 1795

4. Apache 2.2.11
Server/core. c: 2784 Add:
Ap_add_version_component (pconf, "jufukeji ");
Return;
Output Header:
HTTP/1.1 200 OK
Date: Mon, 12 Jan 2009 14:28:10 GMT
Server: jufukeji
Last-Modified: Sat, 20 Nov 2004 20:16:24 GMT
ETag: "1920edd-2c-3e9564c23b600"
Accept-Ranges: bytes
Content-Length: 44
Content-Type: text/html

5. Squid 3.0 STABLE 11
Src/globals. cc: 58 changed:
Const char * const full_appname_string = "jufukeji ";
Output Header:
HTTP/1.0 400 Bad Request
Server: jufukeji
Mime-type: 1.0
Date: Mon, 12 Jan 2009 15:25:15 GMT
Content-Type: text/html
Content-Length: 1553
Expires: Mon, 12 Jan 2009 15:25:15 GMT
X-Squid-Error: ERR_INVALID_URL 0
X-Cache: MISS from 'cache .huhuuworm.org'
Via: 1.0 'cache .huuworm.org '(jufukeji)
Proxy-Connection: close

6. Tomcat 6.0.18
Java/org/apache/coyote/http11/Constants. java: 56 and java/org/apache/coyote/ajp/Constants. java: 236 are changed:
ByteChunk. convertToBytes ("Server: jufukeji" + CRLF );
Output Header:
HTTP/1.1 200 OK
Server: jufukeji
ETag: W/"7857-1216684872000"
Last-Modified: Tue, 22 Jul 2008 00:01:12 GMT
Content-Type: text/html
Content-Length: 7857
Date: Mon, 12 Jan 2009 16:30:44 GMT

7. JBoss 5.0.0 GA
A. Change tomcat/src/resources/web. xml: 40
Jufukeji
B. Download JBoss Web Server 2.1.1.GA srctar (http://www.jboss.org/jbossweb/downloads/jboss-web)
Java/org/apache/coyote/http11/Constants. java: 56 and java/org/apache/coyote/ajp/Constants. java: 236 are changed:
ByteChunk. convertToBytes ("Server: jufukeji" + CRLF );
Overwrite the compiled jbossweb. jar file to the JBoss compilation output file:
JBOSS_SRC/build/output/jboss-5.0.0.GA/server/all/deploy/jbossweb. sar/jbossweb. jar
JBOSS_SRC/build/output/jboss-5.0.0.GA/server/standard/deploy/jbossweb. sar/jbossweb. jar
Jbo ss_src/build/output/jboss-5.0.0.GA/server/default/deploy/jbossweb. sar/jbossweb. jar
JBOSS_SRC/build/output/jboss-5.0.0.GA/server/web/deploy/jbossweb. sar/jbossweb. jar
Output Header:
HTTP/1.1 200 OK
Server: jufukeji
X-Powered-By: jufukeji
Accept-Ranges: bytes
ETag: W/"1581-1231842222000"
Last-Modified: Tue, 13 Jan 2009 10:23:42 GMT
Content-Type: text/html
Content-Length: 1581
Date: Tue, 13 Jan 2009 10:30:42 GM

This article from the "Wang Wei" blog, please be sure to keep this source http://wangwei007.blog.51cto.com/68019/903420


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.