How to install and tune Nginx

2023-12-19 14:48:39

<p>optimization before Nginx compilation [root @ linuxprobe ~] # wget http://nginx.org/download/nginx-1.10.1.tar.gz [root @ linuxprobe ~] # tarxvf nginx-1.10.1.tar.gz-c/usr/ local/src/[root@linuxprobe ~]# cd /usr/local/src/nginx-1.10.1/</p><p>Optimization before compilation is mainly used to modify the program name and so on, such as [root @ Linux probe nginx-1.10.1] # curl-i http://www.baidu.com &amp; hellip; &amp;hellip; Server: bfe/1.0.8.14&amp;hellip; &amp;hellip; [root@linuxprobe nginx-1.10.1]# curl -I http://www.sina.com.cn&amp;hellip; &amp;hellip; Server: nginx&amp;hellip; &amp;hellip; [root @ linuxprobe nginx-1.10.1] # curl-i https://www.linuxprobe.com http/1.1 200 ok server: nginx/1.10.1 # Our goal is to change the name of nginx to Content-Type: text/html; &nbsp;charset=UTF-8Connection: keep-aliveX-Powered-By: PHP/5.6.29Set-Cookie: PHPSESSID=smm0i6u4f9v7bj0gove79ja1g7; path=/Cache-Control: no-cacheDate: Mon, 07 Seq 2016 06:09:11 GMT[root@linuxprobe nginx-1.10.1]# vim src/core/nginx.h</p><p>Aim to change the name and version number of the source code hidden software # define nginx _ versionnginx _ stable # This line changes the version number you want.</p><p># define nginx _ verlinuxprobe/nginx _ version # This line modifies the name of the software you want to modify.</p><p>[root@linuxprobe nginx-1.10.1]# vim +49 src/http/ngx_http_header_filter_module.c</p><p>Modify the connection field in the http header information to prevent the echo of the specific version number from expanding: universal HTTP header field.</p><p>The general header field contains header fields supported by both request and response messages, and the general header fields include Cache-Control, Connection, Date, Pragma, Transfer-Encoding, Upgrade and Via. If the generic header domain 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 can obtain connection information, while others can&#39;t. If they want to be completely hidden, they must be kept completely confidential.</p><p>static char ngx_http_server_string[] = Server: LinuxprobeWeb CRLF;</p><p>[root@linuxprobe nginx-1.10.1]# vim +29 src/http/ngx_http_special_response.c</p><p>Defines the return of http error code. Sometimes when there is an error in our page program, nginx will return the corresponding error code for us. When echoing, it will bring Nginx and version number, and we will hide it.</p><p>static u_char ngx_http_error_full_tail[] =&quot;&quot; NGINX_VER &quot;&quot; CRLF&quot;</p>


Copyright Description:No reproduction without permission。

Knowledge sharing community for developers。

Let more developers benefit from it。

Help developers share knowledge through the Internet。

Follow us