Hide nginx version

Source: Internet
Author: User
# Curl -- headwww. nginx. netHTTP/1.1302 MovedTemporarilyServer: nginx/0.8.38Date: Fri, 04Jun201001: 08: 44GMTContent-Type: text/htmlContent-Length: 161 Connection: keep-alive

 

# Curl -- head www.nginx.net

HTTP/1.1 302 Moved Temporarily

Server: nginx/0.8.38

Date: Fri, 04 Jun 2010 01:08:44 GMT

Content-Type: text/html

Content-Length: 161

Connection: keep-alive

Keep-Alive: timeout = 15

Location: http://nginx.org/

In this way, you can see that your nginx version is 0.8.38.

Can it be left blank?

Of course.

# Vi nginx. conf

Add server_tokens off in http;

Http {

...... Omitted configuration

Sendfile on;

Tcp_nopush on;

Keepalive_timeout 65;

Tcp_nodelay on;

Server_tokens off;

....... Omitted configuration

}

Edit the php-fpm configuration file, such as fcgi. conf and fastcgi. conf (depending on the configuration file name)

Fastcgi_param SERVER_SOFTWARE nginx/$ nginx_version;

Change

Fastcgi_param SERVER_SOFTWARE nginx;

The nginx reload configuration is complete. The nginx version will not be displayed on pages such as 404 and 501.

# Curl -- head 127.0.0.1

HTTP/1.1 200 OK

Server: nginx

Date: Wed, 13 Jan 2010 06:25:01 GMT

Content-Type: text/html

Content-Length: 793

Last-Modified: Sat, 12 Dec 2009 02:28:16 GMT

Connection: keep-alive

Accept-Ranges: bytes

Check the configuration file again:

/Usr/local/nginx/sbin/nginx-t

If the following two lines of information are displayed, the configuration file is correct:

The configuration file/usr/local/webserver/nginx/conf/nginx. conf syntax is OK

The configuration file/usr/local/webserver/nginx/conf/nginx. conf was tested successfully

Smooth restart:

For Nginx 0.8.x, it is very easy to smoothly restart Nginx. run the following command:

/Usr/local/nginx/sbin/nginx-s reload

Related Article

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.