Home > Article > Operation and Maintenance > How to install and tune Nginx
[root@linuxprobe ~]# wget http://nginx.org/download/nginx-1.10.1.tar.gz[root@linuxprobe ~]# tar xvf nginx-1.10.1.tar.gz -C /usr/local/src/[root@linuxprobe ~]# cd /usr/local/src/nginx-1.10.1/
[root@linuxprobe nginx-1.10.1]# curl -I http://www.baidu.com…… Server: bfe/1.0.8.14 …… [root@linuxprobe nginx-1.10.1]# curl -I http://www.sina.com.cn…… Server: nginx …… [root@linuxprobe nginx-1.10.1]# curl -I https://www.linuxprobe.comHTTP/1.1 200 OK Server: nginx/1.10.1 #我们目标是将nginx更改名字Content-Type: text/html; charset=UTF-8 Connection: keep-alive X-Powered-By: PHP/5.6.29 Set-Cookie: PHPSESSID=smm0i6u4f9v7bj0gove79ja1g7; path=/ Cache-Control: no-cache Date: Mon, 07 Seq 2016 06:09:11 GMT [root@linuxprobe nginx-1.10.1]# vim src/core/nginx.h
[root@linuxprobe nginx-1.10.1]# vim +49 src/http/ngx_http_header_filter_module.cModify the connection field in the HTTP header information to prevent the specific version number from being echoedExtension: general http Header fieldsGeneral header fields include header fields supported by both request and response messages. Common header fields include Cache-Control, Connection, Date, Pragma, Transfer-Encoding, Upgrade, and Via. If the common header field is extended, both parties need to support this extension. If there is an unsupported general header field, it will generally be treated as an entity header field. Some devices or software are able to obtain connection information, while others are not. If you want to completely hide it, you must do comprehensive confidentialitystatic char ngx_http_server_string[] = "Server: LinuxprobeWeb" CRLF;
[root@linuxprobe nginx-1.10.1]# vim +29 src/http/ngx_http_special_response.cDefines the return of http error codesSometimes there is an error in our page program, Nginx will return the corresponding error code on our behalf. When echoed, it will bring nginx and version number, and we hide it Get up
static u_char ngx_http_error_full_tail[] ="" NGINX_VER "" CRLF"
The above is the detailed content of How to install and tune Nginx. For more information, please follow other related articles on the PHP Chinese website!