Nginx 性能优化有这篇就够了!
<h3 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">1、Nginx运行工作进程数量</span></h3>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">Nginx运行工作进程个数<span style="color: black;">通常</span>设置CPU的核心<span style="color: black;">或</span>核心数x2。<span style="color: black;">倘若</span>不<span style="color: black;">认识</span>cpu的核数,<span style="color: black;">能够</span>top命令之后按1看出来,<span style="color: black;">亦</span><span style="color: black;">能够</span>查看/proc/cpuinfo文件 grep ^processor /proc/cpuinfo | wc -l。</span></p><span style="color: black;"><span style="color: black;"></span># <span style="color: black;">vi</span>/<span style="color: black;">usr</span>/<span style="color: black;">local</span>/<span style="color: black;">nginx1</span><span style="color: black;">.10</span>/<span style="color: black;">conf</span>/<span style="color: black;">nginx</span><span style="color: black;">.conf</span></span><span style="color: black;"><span style="color: black;">worker_processes</span> <span style="color: black;">4</span>;</span><span style="color: black;"><span style="color: black;"></span># /<span style="color: black;">usr</span>/<span style="color: black;">local</span>/<span style="color: black;">nginx1</span><span style="color: black;">.10</span>/<span style="color: black;">sbin</span>/<span style="color: black;">nginx-s</span> <span style="color: black;">reload</span></span><span style="color: black;"><span style="color: black;"></span># <span style="color: black;">ps</span> <span style="color: black;">-aux</span> | <span style="color: black;">grep</span> <span style="color: black;">nginx</span> |<span style="color: black;">grep</span> <span style="color: black;">-v</span> <span style="color: black;">grep</span></span><span style="color: black;"><span style="color: black;">root</span> <span style="color: black;">9834</span> <span style="color: black;">0</span><span style="color: black;">.0</span> <span style="color: black;">0</span><span style="color: black;">.0</span> <span style="color: black;">47556</span> <span style="color: black;">1948</span> ? <span style="color: black;">Ss</span> <span style="color: black;">22</span><span style="color: black;">:36</span> <span style="color: black;">0</span><span style="color: black;">:00</span> <span style="color: black;">nginx</span>: <span style="color: black;">master</span> <span style="color: black;">processnginx</span></span><span style="color: black;"><span style="color: black;">www</span> <span style="color: black;">10135</span> <span style="color: black;">0</span><span style="color: black;">.0</span> <span style="color: black;">0</span><span style="color: black;">.0</span> <span style="color: black;">50088</span> <span style="color: black;">2004</span> ? <span style="color: black;">S</span> <span style="color: black;">22</span><span style="color: black;">:58</span> <span style="color: black;">0</span><span style="color: black;">:00</span> <span style="color: black;">nginx</span>: <span style="color: black;">worker</span> <span style="color: black;">process</span></span><span style="color: black;"><span style="color: black;">www</span> <span style="color: black;">10136</span> <span style="color: black;">0</span><span style="color: black;">.0</span> <span style="color: black;">0</span><span style="color: black;">.0</span> <span style="color: black;">50088</span> <span style="color: black;">2004</span> ? <span style="color: black;">S</span> <span style="color: black;">22</span><span style="color: black;">:58</span> <span style="color: black;">0</span><span style="color: black;">:00</span> <span style="color: black;">nginx</span>: <span style="color: black;">worker</span> <span style="color: black;">process</span></span><span style="color: black;"><span style="color: black;">www</span> <span style="color: black;">10137</span> <span style="color: black;">0</span><span style="color: black;">.0</span> <span style="color: black;">0</span><span style="color: black;">.0</span> <span style="color: black;">50088</span> <span style="color: black;">2004</span> ? <span style="color: black;">S</span> <span style="color: black;">22</span><span style="color: black;">:58</span> <span style="color: black;">0</span><span style="color: black;">:00</span> <span style="color: black;">nginx</span>: <span style="color: black;">worker</span> <span style="color: black;">process</span></span><span style="color: black;"><span style="color: black;">www</span> <span style="color: black;">10138</span> <span style="color: black;">0</span><span style="color: black;">.0</span> <span style="color: black;">0</span><span style="color: black;">.0</span> <span style="color: black;">50088</span> <span style="color: black;">2004</span> ? <span style="color: black;">S</span> <span style="color: black;">22</span><span style="color: black;">:58</span> <span style="color: black;">0</span><span style="color: black;">:00</span> <span style="color: black;">nginx</span>: <span style="color: black;">worker</span> <span style="color: black;">process</span></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">2、Nginx运行CPU亲和力</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">例如</span>4核配置:</span></p><span style="color: black;"><span style="color: black;">worker_processes</span> <span style="color: black;">4</span>;</span><span style="color: black;"><span style="color: black;">worker_cpu_affinity</span> <span style="color: black;">0001</span> <span style="color: black;">0010</span> <span style="color: black;">0100</span> <span style="color: black;">1000</span></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">例如</span>8核配置:</span></p><span style="color: black;"><span style="color: black;">worker_processes</span> <span style="color: black;">8</span>;</span><span style="color: black;"><span style="color: black;">worker_cpu_affinity</span> <span style="color: black;">00000001</span> <span style="color: black;">00000010</span> <span style="color: black;">00000100</span> <span style="color: black;">0000100000010000</span> <span style="color: black;">00100000</span> <span style="color: black;">01000000</span> <span style="color: black;">10000000</span>;</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">worker_processes最多开启8个,8个以上性能<span style="color: black;">提高</span>不会再<span style="color: black;">提高</span>了,<span style="color: black;">况且</span>稳定性变得更低,<span style="color: black;">因此</span>8个进程够用了。</span></p>
<h3 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">3、Nginx最大打开文件数</span></h3><span style="color: black;"><span style="color: black;">worker_rlimit_nofile</span> <span style="color: black;">65535</span>;</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">这个指令<span style="color: black;">指的是</span>当一个nginx进程打开的最多文件描述符数目,理论值应该是最多打开文件数(ulimit -n)与nginx进程数相除,<span style="color: black;">然则</span>nginx分配请求并不是<span style="color: black;">那样</span>均匀,<span style="color: black;">因此</span>最好与ulimit -n的值保持一致。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">注:文件资源限制的配置<span style="color: black;">能够</span>在/etc/security/limits.conf设置,针对root/user等各个用户<span style="color: black;">或</span>*<span style="color: black;">表率</span>所有用户来设置。</span></p><span style="color: black;"><span style="color: black;">* </span>soft nofile 65535</span><span style="color: black;"><span style="color: black;">* </span>hard nofile 65535</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">用户重新登录生效(ulimit -n)</span></p>
<h3 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">4、Nginx事件处理模型</span></h3><span style="color: black;"><span style="color: black;">events</span> {</span> <span style="color: black;"><span style="color: black;">use</span> <span style="color: black;">epoll</span>;</span> <span style="color: black;"><span style="color: black;">worker_connections</span> <span style="color: black;">65535</span>;</span> <span style="color: black;"><span style="color: black;">multi_accept</span> <span style="color: black;">on</span>;</span><span style="color: black;">}</span>
<h3 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">nginx采用epoll事件模型,处理效率高。</span></h3>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">work_connections是单个worker进程<span style="color: black;">准许</span>客户端最大连接数,这个数值<span style="color: black;">通常</span><span style="color: black;">按照</span>服务器性能和内存来制定,<span style="color: black;">实质</span>最大值<span style="color: black;">便是</span>worker进程数乘以work_connections。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">实质</span><span style="color: black;">咱们</span>填入一个65535,足够了,这些都算并发值,一个网站的并发达到这么大的数量,<span style="color: black;">亦</span>算一个大站了!</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">multi_accept 告诉nginx收到一个新连接<span style="color: black;">通告</span>后接受尽可能多的连接,默认是on,设置为on后,多个worker按串行方式来处理连接,<span style="color: black;">亦</span><span style="color: black;">便是</span>一个连接<span style="color: black;">仅有</span>一个worker被唤醒,其他的<span style="color: black;">处在</span>休眠状态,设置为off后,多个worker按并行方式来处理连接,<span style="color: black;">亦</span><span style="color: black;">便是</span>一个连接会唤醒所有的worker,直到连接分配完毕,<span style="color: black;">无</span>取得连接的继续休眠。当你的服务器连接数不多时,开启这个参数会让负载有<span style="color: black;">必定</span>的降低,<span style="color: black;">然则</span>当服务器的吞吐量很大时,为了效率,<span style="color: black;">能够</span>关闭这个参数。</span></p>
<h3 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">5、开启<span style="color: black;">有效</span>传输模式</span></h3><span style="color: black;">http {</span><span style="color: black;"> include mime.types;</span><span style="color: black;"> default_type application/octet-stream;</span><span style="color: black;"> ……</span><span style="color: black;"> sendfile <span style="color: black;">on</span>;</span><span style="color: black;"> tcp_nopush <span style="color: black;">on</span>;</span><span style="color: black;"> ……</span><span style="color: black;">}</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">Include mime.types :<span style="color: black;">媒介</span>类型,include 只是一个在当前文件中<span style="color: black;">包括</span>另一个文件内容的指令。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">default_type application/octet-stream :默认<span style="color: black;">媒介</span>类型足够。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">sendfile on:开启<span style="color: black;">有效</span>文件传输模式,sendfile指令指定nginx<span style="color: black;">是不是</span>调用sendfile函数来输出文件,<span style="color: black;">针对</span>普通应用设为 on,<span style="color: black;">倘若</span>用来进行下载等应用磁盘IO重负载应用,可设置为off,以平衡磁盘与网络I/O处理速度,降低系统的负载。<span style="color: black;">重视</span>:<span style="color: black;">倘若</span><span style="color: black;">照片</span><span style="color: black;">表示</span>不正常把这个改成off。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">tcp_nopush on:必须在sendfile开启模式才有效,防止网路阻塞,积极的减少网络报文段的数量(将响应头和正文的<span style="color: black;">起始</span>部分<span style="color: black;">一块</span>发送,而不一个接一个的发送。)</span></p>
<h3 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">6、连接超时时间</span></h3>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">重点</span>目的是<span style="color: black;">守护</span>服务器资源,CPU,内存,<span style="color: black;">掌控</span>连接数,<span style="color: black;">由于</span><span style="color: black;">创立</span>连接<span style="color: black;">亦</span>是需要消耗资源的。</span></p><span style="color: black;"><span style="color: black;">keepalive_timeout</span> <span style="color: black;">60</span>;</span><span style="color: black;"><span style="color: black;">tcp_nodelay</span> <span style="color: black;">on</span>;</span><span style="color: black;"><span style="color: black;">client_header_buffer_size</span> <span style="color: black;">4k</span>;</span><span style="color: black;"><span style="color: black;">open_file_cache</span>max=<span style="color: black;">102400</span> inactive=<span style="color: black;">20s</span>;</span><span style="color: black;"><span style="color: black;">open_file_cache_valid</span> <span style="color: black;">30s</span>;</span><span style="color: black;"><span style="color: black;">open_file_cache_min_uses</span> <span style="color: black;">1</span>;</span><span style="color: black;"><span style="color: black;">client_header_timeout</span> <span style="color: black;">15</span>;</span><span style="color: black;"><span style="color: black;">client_body_timeout</span> <span style="color: black;">15</span>;</span><span style="color: black;"><span style="color: black;">reset_timedout_connection</span> <span style="color: black;">on</span>;</span><span style="color: black;"><span style="color: black;">send_timeout</span> <span style="color: black;">15</span>;</span><span style="color: black;"><span style="color: black;">server_tokens</span> <span style="color: black;">off</span>;</span><span style="color: black;"><span style="color: black;">client_max_body_size</span> <span style="color: black;">10m</span>;</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">keepalived_timeout :客户端连接保持会话超时时间,超过这个时间,服务器断开这个链接。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">tcp_nodelay:<span style="color: black;">亦</span>是防止网络阻塞,<span style="color: black;">不外</span>要包涵在keepalived参数才有效。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">client_header_buffer_size 4k:客户端请求头部的缓冲区<span style="color: black;">体积</span>,这个<span style="color: black;">能够</span><span style="color: black;">按照</span>你的系统分页<span style="color: black;">体积</span>来设置,<span style="color: black;">通常</span>一个请求头的<span style="color: black;">体积</span>不会超过 1k,<span style="color: black;">不外</span><span style="color: black;">因为</span><span style="color: black;">通常</span>系统分页都要大于1k,<span style="color: black;">因此</span><span style="color: black;">这儿</span>设置为分页<span style="color: black;">体积</span>。分页<span style="color: black;">体积</span><span style="color: black;">能够</span>用命令getconf PAGESIZE取得。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">open_file_cache max=102400 inactive=20s :这个将为打开文件指定缓存,默认是<span style="color: black;">无</span>启用的,max指定缓存数量,<span style="color: black;">意见</span>和打开文件数一致,inactive <span style="color: black;">指的是</span>经<span style="color: black;">太多</span><span style="color: black;">长期</span>文件没被请求后删除缓存。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">open_file_cache_valid 30s:这个<span style="color: black;">指的是</span>多<span style="color: black;">长期</span><span style="color: black;">检测</span>一次缓存的有效信息。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">open_file_cache_min_uses 1 :open_file_cache指令中的inactive 参数时间内文件的最少<span style="color: black;">运用</span>次数,<span style="color: black;">倘若</span>超过这个数字,文件描述符<span style="color: black;">始终</span>是在缓存中打开的,如上例,<span style="color: black;">倘若</span>有一个文件在inactive 时间内一次没被<span style="color: black;">运用</span>,它将被移除。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">client_header_timeout :设置请求头的超时时间。<span style="color: black;">咱们</span><span style="color: black;">亦</span><span style="color: black;">能够</span>把这个设置低些,<span style="color: black;">倘若</span>超过这个时间<span style="color: black;">无</span>发送任何数据,nginx将返回request time out的错误。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">client_body_timeout设置请求体的超时时间。<span style="color: black;">咱们</span><span style="color: black;">亦</span><span style="color: black;">能够</span>把这个设置低些,超过这个时间<span style="color: black;">无</span>发送任何数据,和上面<span style="color: black;">同样</span>的错误提示。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">reset_timeout_connection :告诉nginx关闭不响应的客户端连接。这将会释放那个客户端所占有的内存空间。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">send_timeout<span style="color: black;"> :</span>响应客户端超时时间,这个超时时间仅限于两个活动之间的时间,<span style="color: black;">倘若</span>超过这个时间,客户端<span style="color: black;">无</span>任何活动,nginx关闭连接。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">server_tokens <span style="color: black;">:</span>并不会让nginx执行的速度更快,但它<span style="color: black;">能够</span>关闭在错误页面中的nginx版本数字,<span style="color: black;">这般</span><span style="color: black;">针对</span>安全性是有好处的。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">client_max_body_size:上传文件<span style="color: black;">体积</span>限制。</span></p>
<h3 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">7、fastcgi 调优</span></h3><span style="color: black;">fastcgi_connect_timeout 600;</span><span style="color: black;">fastcgi_send_timeout 600;</span><span style="color: black;">fastcgi_read_timeout 600;</span><span style="color: black;">fastcgi_buffer_size 64k;</span><span style="color: black;">fastcgi_buffers 4 64k;</span><span style="color: black;">fastcgi_busy_buffers_size 128k;</span><span style="color: black;">fastcgi_temp_file_write_size 128k;</span><span style="color: black;">fastcgi_temp_path/usr/<span style="color: black;">local</span>/nginx1.10/nginx_tmp;</span><span style="color: black;">fastcgi_intercept_errors on;</span><span style="color: black;">fastcgi_cache_path/usr/<span style="color: black;">local</span>/nginx1.10/fastcgi_cache levels=1:2 keys_zone=cache_fastcgi:128minactive=1d max_size=10g;</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">fastcgi_connect_timeout 600 :指定连接到后端FastCGI的超时时间。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">fastcgi_send_timeout 600 :向FastCGI传送请求的超时时间。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">fastcgi_read_timeout 600 :指定接收FastCGI应答的超时时间。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">fastcgi_buffer_size 64k :指定读取FastCGI应答<span style="color: black;">第1</span>部分需要用多大的缓冲区,默认的缓冲区<span style="color: black;">体积</span>为。fastcgi_buffers指令中的每块<span style="color: black;">体积</span>,<span style="color: black;">能够</span>将这个值设置更小。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">fastcgi_buffers 4 64k :指定本地需要用多少和多大的缓冲区来缓冲FastCGI的应答请求,<span style="color: black;">倘若</span>一个php脚本所产生的页面<span style="color: black;">体积</span>为256KB,<span style="color: black;">那样</span>会分配4个64KB的缓冲区来缓存,<span style="color: black;">倘若</span>页面<span style="color: black;">体积</span>大于256KB,<span style="color: black;">那样</span>大于256KB的部分会缓存到fastcgi_temp_path指定的路径中,<span style="color: black;">然则</span>这并不是好<span style="color: black;">办法</span>,<span style="color: black;">由于</span>内存中的数据处理速度要快于磁盘。<span style="color: black;">通常</span>这个值应该为站点中php脚本所产生的页面<span style="color: black;">体积</span>的中间值,<span style="color: black;">倘若</span>站点大部分脚本所产生的页面<span style="color: black;">体积</span>为256KB,<span style="color: black;">那样</span><span style="color: black;">能够</span>把这个值设置为“8 32K”、“4 64k”等。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">fastcgi_busy_buffers_size 128k :<span style="color: black;">意见</span>设置为fastcgi_buffers的两倍,繁忙时候的buffer。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">fastcgi_temp_file_write_size 128k :在写入fastcgi_temp_path时将用多大的数据块,默认值是fastcgi_buffers的两倍,该数值设置小时若负载上来时可能报502BadGateway。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">fastcgi_temp_path :缓存临时目录。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">fastcgi_intercept_errors on :这个指令指定<span style="color: black;">是不是</span>传递4xx和5xx错误信息到客户端,<span style="color: black;">或</span><span style="color: black;">准许</span>nginx<span style="color: black;">运用</span>error_page处理错误信息。注:静态文件不存在会返回404页面,<span style="color: black;">然则</span>php页面则返回空白页!</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">fastcgi_cache_path /usr/local/nginx1.10/fastcgi_cachelevels=1:2 keys_zone=cache_fastcgi:128minactive=1d max_size=10g :fastcgi_cache缓存目录,<span style="color: black;">能够</span>设置目录层级,<span style="color: black;">例如</span>1:2会生成16*256个子目录,cache_fastcgi是这个缓存空间的名字,cache是用多少内存(<span style="color: black;">这般</span>热门的内容nginx直接放内存,<span style="color: black;">加强</span><span style="color: black;">拜访</span>速度),inactive<span style="color: black;">暗示</span>默认失效时间,<span style="color: black;">倘若</span>缓存数据在失效时间内<span style="color: black;">无</span>被<span style="color: black;">拜访</span>,将被删除,max_size<span style="color: black;">暗示</span>最多用多少硬盘空间。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">fastcgi_cache cache_fastcgi :#<span style="color: black;">暗示</span>开启FastCGI缓存并为其指定一个名<span style="color: black;">叫作</span>。开启缓存非常有用,<span style="color: black;">能够</span>有效降低CPU的负载,并且防止502的错误放生。cache_fastcgi为proxy_cache_path指令创建的缓存区名<span style="color: black;">叫作</span>。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">fastcgi_cache_valid 200 302 1h :#用来指定应答代码的缓存时间,实例中的值<span style="color: black;">暗示</span>将200和302应答缓存一小时,要和fastcgi_cache<span style="color: black;">协同</span><span style="color: black;">运用</span>。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">fastcgi_cache_valid 301 1d :将301应答缓存一天。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">fastcgi_cache_valid any 1m :将其他应答缓存为1分钟。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">fastcgi_cache_min_uses 1 :该指令用于设置经<span style="color: black;">太多</span>少次请求的相同URL将被缓存。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">fastcgi_cache_key http://$host$request_uri :该指令用来设置web缓存的Key值,nginx<span style="color: black;">按照</span>Key值md5哈希存储.<span style="color: black;">通常</span><span style="color: black;">按照</span>$host(域名)、$request_uri(请求的路径)等变量组合成proxy_cache_key 。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">fastcgi_pass :指定FastCGI服务器监听端口与<span style="color: black;">位置</span>,<span style="color: black;">能够</span>是本机<span style="color: black;">或</span>其它。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><strong style="color: blue;">总结:</strong></span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">nginx的缓存功能有:proxy_cache / fastcgi_cache</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">proxy_cache的<span style="color: black;">功效</span>是缓存后端服务器的内容,可能是任何内容,<span style="color: black;">包含</span>静态的和动态。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">fastcgi_cache的<span style="color: black;">功效</span>是缓存fastcgi生成的内容,<span style="color: black;">非常多</span><span style="color: black;">状况</span>是php生成的动态的内容。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">proxy_cache缓存减少了nginx与后端通信的次数,节省了传输时间和后端宽带。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">fastcgi_cache缓存减少了nginx与php的通信的次数,更减轻了php和数据库(mysql)的压力。</span></p>
<h3 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">8、gzip 调优</span></h3>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">运用</span>gzip压缩功能,可能为<span style="color: black;">咱们</span>节约带宽,加快传输速度,有更好的体验,<span style="color: black;">亦</span>为<span style="color: black;">咱们</span>节约成本,<span style="color: black;">因此</span>说这是一个重点。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">Nginx启用压缩功能需要你来ngx_http_gzip_module模块,apache<span style="color: black;">运用</span>的是mod_deflate。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">通常</span><span style="color: black;">咱们</span>需要压缩的内容有:文本,js,html,css,<span style="color: black;">针对</span><span style="color: black;">照片</span>,视频,flash什么的不压缩,<span style="color: black;">同期</span><span style="color: black;">亦</span>要<span style="color: black;">重视</span>,<span style="color: black;">咱们</span><span style="color: black;">运用</span>gzip的功能是需要消耗CPU的!</span></p><span style="color: black;">gzip <span style="color: black;">on</span>;</span><span style="color: black;">gzip_min_length<span style="color: black;">2</span>k;</span><span style="color: black;">gzip_buffers <span style="color: black;">4</span> <span style="color: black;">32</span>k;</span><span style="color: black;">gzip_http_version <span style="color: black;">1.1</span>;</span><span style="color: black;">gzip_comp_level <span style="color: black;">6</span>;</span><span style="color: black;">gzip_typestext/plain text/css text/javascriptapplication/json application/javascript application/x-javascriptapplication/xml;</span><span style="color: black;">gzip_vary <span style="color: black;">on</span>;</span><span style="color: black;">gzip_proxied any;</span><span style="color: black;">gzip <span style="color: black;">on</span>; <span style="color: black;">#开启压缩功能</span></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">gzip_min_length 1k :设置<span style="color: black;">准许</span>压缩的页面最小字节数,页面字节数从header头的Content-Length中获取,默认值是0,不管页面多大都进行压缩,<span style="color: black;">意见</span>设置成大于1K,<span style="color: black;">倘若</span>小与1K可能会越压越大。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">gzip_buffers 4 32k :压缩缓冲区<span style="color: black;">体积</span>,<span style="color: black;">暗示</span>申请4个单位为32K的内存<span style="color: black;">做为</span>压缩结果流缓存,默认值是申请与原始数据<span style="color: black;">体积</span>相同的内存空间来存储gzip压缩结果。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">gzip_http_version 1.1 :压缩版本,用于设置识别HTTP协议版本,默认是1.1,<span style="color: black;">日前</span>大部分浏览器<span style="color: black;">已然</span>支持GZIP解压,<span style="color: black;">运用</span>默认<span style="color: black;">就可</span>。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">gzip_comp_level 6 :压缩比例,用来指定GZIP压缩比,1压缩比最小,处理速度最快,9压缩比最大,传输速度快,<span style="color: black;">然则</span>处理慢,<span style="color: black;">亦</span>比较消耗CPU资源。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">gzip_types text/css text/xml application/javascript :用来指定压缩的类型,‘text/html’类型总是会被压缩。默认值: gzip_types text/html (默认不对js/css文件进行压缩)</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">压缩类型,匹配MIME型进行压缩;</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">不可</span>用通配符 text/*;</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">text/html默认<span style="color: black;">已然</span>压缩 (无论<span style="color: black;">是不是</span>指定);</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">设置哪压缩种文本文件可参考 conf/mime.types。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">gzip_vary on :varyheader支持,改选项<span style="color: black;">能够</span>让前端的缓存服务器缓存经过GZIP压缩的页面,例如用Squid缓存经过nginx压缩的数据。</span></p>
<h3 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">9、expires 缓存调优</span></h3>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">缓存,<span style="color: black;">重点</span>针<span style="color: black;">针对</span><span style="color: black;">照片</span>,css,js等元素更改机会比较少的<span style="color: black;">状况</span>下<span style="color: black;">运用</span>,<span style="color: black;">尤其</span>是<span style="color: black;">照片</span>,占用带宽大,<span style="color: black;">咱们</span>完全<span style="color: black;">能够</span>设置<span style="color: black;">照片</span>在浏览器本地缓存365d,css,js,html<span style="color: black;">能够</span>缓存个10来天,<span style="color: black;">这般</span>用户<span style="color: black;">第1</span>次打开加载慢一点,第二次,就非常快了!缓存的时候,<span style="color: black;">咱们</span>需要将需要缓存的拓展名列出来, Expires缓存配置在server字段里面。</span></p><span style="color: black;"><span style="color: black;">location</span> <span style="color: black;">~* \.(ico|jpe?g|gif|png|bmp|swf|flv)$</span> {</span><span style="color: black;"><span style="color: black;">expires</span> <span style="color: black;">30d</span>;</span><span style="color: black;">#log_not_found off;</span><span style="color: black;"><span style="color: black;">access_log</span> <span style="color: black;">off</span>;</span><span style="color: black;">}</span><span style="color: black;"><span style="color: black;">location</span> <span style="color: black;">~* \.(js|css)$</span> {</span><span style="color: black;"><span style="color: black;">expires</span> <span style="color: black;">7d</span>;</span><span style="color: black;"><span style="color: black;">log_not_found</span> <span style="color: black;">off</span>;</span><span style="color: black;"><span style="color: black;">access_log</span> <span style="color: black;">off</span>;</span><span style="color: black;">}</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">注:log_not_found off;<span style="color: black;">是不是</span>在error_log中记录不存在的错误。默认是。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">总结:</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">expire功能优点:</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">expires<span style="color: black;">能够</span>降低网站购买的带宽,节约成本;</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">同期</span><span style="color: black;">提高</span>用户<span style="color: black;">拜访</span>体验;</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">减轻服务的压力,节约服务器成本,是web服务非常重要的功能。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">expire功能缺点:</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">被缓存的页面或数据更新了,用户看到的可能还是旧的内容,反而影响用户体验。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">处理</span>办法:<span style="color: black;">第1</span>个缩短缓存时间,例如:1天,但不彻底,除非更新频率大于1天;第二个对缓存的对象改名。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">网站不<span style="color: black;">期盼</span>被缓存的内容:</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">网站流量统计工具;</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">更新频繁的文件(google的logo)。</span></p>
<h3 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;"><span style="color: black;">十、</span>内核参数优化</span></h3>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">fs.file-max = 999999:这个参数<span style="color: black;">暗示</span>进程(<span style="color: black;">例如</span>一个worker进程)<span style="color: black;">能够</span><span style="color: black;">同期</span>打开的最大句柄数,这个参数直线限制最大并发连接数,需<span style="color: black;">按照</span><span style="color: black;">实质</span><span style="color: black;">状况</span>配置。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">net.ipv4.tcp_max_tw_buckets = 6000 :这个参数<span style="color: black;">暗示</span>操作系统<span style="color: black;">准许</span>TIME_WAIT套接字数量的最大值,<span style="color: black;">倘若</span>超过这个数字,TIME_WAIT套接字将立刻被清除并打印警告信息。该参数默认为180000,<span style="color: black;">太多</span>的TIME_WAIT套接字会使Web服务器变慢。注:主动关闭连接的服务端会产生TIME_WAIT状态的连接</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">net.ipv4.ip_local_port_range = 1024 65000 :<span style="color: black;">准许</span>系统打开的端口范围。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">net.ipv4.tcp_tw_recycle = 1 :启用timewait快速回收。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">net.ipv4.tcp_tw_reuse = 1 :开启重用。<span style="color: black;">准许</span>将TIME-WAIT sockets重新用于新的TCP连接。这<span style="color: black;">针对</span>服务器<span style="color: black;">来讲</span><span style="color: black;">特别有</span><span style="color: black;">道理</span>,<span style="color: black;">由于</span>服务器上总会有<span style="color: black;">海量</span>TIME-WAIT状态的连接。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">net.ipv4.tcp_keepalive_time = 30:这个参数<span style="color: black;">暗示</span>当keepalive启用时,TCP发送keepalive<span style="color: black;">信息</span>的频度。默认是2小时,若将其设置的小<span style="color: black;">有些</span>,<span style="color: black;">能够</span>更快地清理无效的连接。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">net.ipv4.tcp_syncookies = 1 :开启SYN Cookies,当<span style="color: black;">显现</span>SYN等待队列溢出时,启用cookies来处理。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">net.core.somaxconn = 40960 :web 应用中 listen 函数的 backlog 默认会给<span style="color: black;">咱们</span>内核参数的。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">net.core.somaxconn :限制到128,而nginx定义的NGX_LISTEN_BACKLOG 默认为511,<span style="color: black;">因此</span>有必要<span style="color: black;">调节</span>这个值。注:对于一个TCP连接,Server与Client需要<span style="color: black;">经过</span>三次握手来<span style="color: black;">创立</span>网络连接.当三次握手成功后,<span style="color: black;">咱们</span><span style="color: black;">能够</span>看到端口的状态由LISTEN转变为ESTABLISHED,接着这条链路上就<span style="color: black;">能够</span><span style="color: black;">起始</span>传送数据了.每一个<span style="color: black;">处在</span>监听(Listen)状态的端口,都有自己的监听队列.监听队列的长度与如somaxconn参数和<span style="color: black;">运用</span>该端口的程序中listen()函数<span style="color: black;">相关</span>。somaxconn定义了系统中每一个端口最大的监听队列的长度,这是个全局的参数,默认值为128,<span style="color: black;">针对</span>一个经常处理新连接的高负载 web服务环境<span style="color: black;">来讲</span>,默认的 128 太小了。大<span style="color: black;">都数</span>环境这个值<span style="color: black;">意见</span><span style="color: black;">增多</span>到 1024 <span style="color: black;">或</span><span style="color: black;">更加多</span>。大的侦听队列对防止拒绝服务 DoS 攻击<span style="color: black;">亦</span>会有所<span style="color: black;">帮忙</span>。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">net.core.netdev_max_backlog = 262144 :<span style="color: black;">每一个</span>网络接口接收数据包的速率比内核处理这些包的速率快时,<span style="color: black;">准许</span>送到队列的数据包的最大数目。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">net.ipv4.tcp_max_syn_backlog = 262144 :这个参数标示TCP三次握手<span style="color: black;">创立</span><span style="color: black;">周期</span>接受SYN请求队列的最大长度,默认为1024,将其设置得大<span style="color: black;">有些</span><span style="color: black;">能够</span>使<span style="color: black;">显现</span>Nginx繁忙来不及accept新连接的<span style="color: black;">状况</span>时,Linux不至于丢失客户端发起的连接请求。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">net.ipv4.tcp_rmem = 10240 87380 12582912 :这个参数定义了TCP接受缓存(用于TCP接受滑动窗口)的最小值、默认值、最大值。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">net.ipv4.tcp_wmem = 10240 87380 12582912:这个参数定义了TCP发送缓存(用于TCP发送滑动窗口)的最小值、默认值、最大值。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">net.core.rmem_default = 6291456:这个参数<span style="color: black;">暗示</span>内核套接字接受缓存区默认的<span style="color: black;">体积</span>。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">net.core.wmem_default = 6291456:这个参数<span style="color: black;">暗示</span>内核套接字发送缓存区默认的<span style="color: black;">体积</span>。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">net.core.rmem_max = 12582912:这个参数<span style="color: black;">暗示</span>内核套接字接受缓存区的最大<span style="color: black;">体积</span>。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">net.core.wmem_max = 12582912:这个参数<span style="color: black;">暗示</span>内核套接字发送缓存区的最大大小。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">net.ipv4.tcp_syncookies = 1:该参数与性能无关,用于<span style="color: black;">处理</span>TCP的SYN攻击。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">下面贴一个完整的内核优化设置:</span></p><span style="color: black;">fs.<span style="color: black;">file</span>-<span style="color: black;">max</span> = <span style="color: black;">999999</span></span><span style="color: black;">net.ipv4.ip_forward = <span style="color: black;">0</span></span><span style="color: black;">net.ipv4.<span style="color: black;">conf</span>.default.rp_filter = <span style="color: black;">1</span></span><span style="color: black;">net.ipv4.<span style="color: black;">conf</span>.default.accept_source_route = <span style="color: black;">0</span></span><span style="color: black;">kernel.sysrq = <span style="color: black;">0</span></span><span style="color: black;">kernel.core_uses_pid = <span style="color: black;">1</span></span><span style="color: black;">net.ipv4.tcp_syncookies = <span style="color: black;">1</span></span><span style="color: black;">kernel.msgmnb = <span style="color: black;">65536</span></span><span style="color: black;">kernel.msgmax = <span style="color: black;">65536</span></span><span style="color: black;">kernel.shmmax =<span style="color: black;">68719476736</span></span><span style="color: black;">kernel.shmall = <span style="color: black;">4294967296</span></span><span style="color: black;">net.ipv4.tcp_max_tw_buckets = <span style="color: black;">6000</span></span><span style="color: black;">net.ipv4.tcp_sack = <span style="color: black;">1</span></span><span style="color: black;">net.ipv4.tcp_window_scaling = <span style="color: black;">1</span></span><span style="color: black;">net.ipv4.tcp_rmem = <span style="color: black;">10240</span> <span style="color: black;">87380</span> <span style="color: black;">12582912</span></span><span style="color: black;">net.ipv4.tcp_wmem = <span style="color: black;">10240</span> <span style="color: black;">87380</span> <span style="color: black;">12582912</span></span><span style="color: black;">net.core.wmem_default = <span style="color: black;">8388608</span></span><span style="color: black;">net.core.rmem_default = <span style="color: black;">8388608</span></span><span style="color: black;">net.core.rmem_max = <span style="color: black;">16777216</span></span><span style="color: black;">net.core.wmem_max =<span style="color: black;">16777216</span></span><span style="color: black;">net.core.netdev_max_backlog = <span style="color: black;">262144</span></span><span style="color: black;">net.core.somaxconn = <span style="color: black;">40960</span></span><span style="color: black;">net.ipv4.tcp_max_orphans = <span style="color: black;">3276800</span></span><span style="color: black;">net.ipv4.tcp_max_syn_backlog = <span style="color: black;">262144</span></span><span style="color: black;">net.ipv4.tcp_timestamps =<span style="color: black;">0</span></span><span style="color: black;">net.ipv4.tcp_synack_retries = <span style="color: black;">1</span></span><span style="color: black;">net.ipv4.tcp_syn_retries = <span style="color: black;">1</span></span><span style="color: black;">net.ipv4.tcp_tw_recycle = <span style="color: black;">1</span></span><span style="color: black;">net.ipv4.tcp_tw_reuse = <span style="color: black;">1</span></span><span style="color: black;">net.ipv4.tcp_mem = <span style="color: black;">94500000</span> <span style="color: black;">915000000</span> <span style="color: black;">927000000</span></span><span style="color: black;">net.ipv4.tcp_fin_timeout = <span style="color: black;">1</span></span><span style="color: black;">net.ipv4.tcp_keepalive_time = <span style="color: black;">30</span></span><span style="color: black;">net.ipv4.ip_local_port_range = <span style="color: black;">1024</span> <span style="color: black;">65000</span></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">执行sysctl -p使内核修改生效。</span></p><img src="data:image/svg+xml,%3C%3Fxml version=1.0 encoding=UTF-8%3F%3E%3Csvg width=1px height=1px viewBox=0 0 1 1 version=1.1 xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink%3E%3Ctitle%3E%3C/title%3E%3Cg stroke=none stroke-width=1 fill=none fill-rule=evenodd fill-opacity=0%3E%3Cg transform=translate(-249.000000, -126.000000) fill=%23FFFFFF%3E%3Crect x=249 y=126 width=1 height=1%3E%3C/rect%3E%3C/g%3E%3C/g%3E%3C/svg%3E" style="width: 50%; margin-bottom: 20px;"><span style="color: black;"><strong style="color: blue;">往期<span style="color: black;">举荐</span></strong></span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;">K8s上应该用哪个JD</a>K?8种JDK性能测试</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;">Linux 11个性能分析工具,快准狠!</a></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;">Dockerfile 语法又<span style="color: black;">加强</span>了!</a></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;">Docker 吃掉<span style="color: black;">海量</span>磁盘空间怎么办?</a></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;">Nginx 日志切割利器</a></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;">Linux一个很强大的命令:lsof</a></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;">阿里 Nacos 学习手册,很<span style="color: black;">仔细</span>!</a></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;">构建容器镜像利器:BuildKit</a></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;">K8s Pod “OOM Kill</a>er”,<span style="color: black;">原由</span>找到了</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">货拉拉<span style="color: black;">机构</span>,3年运维零故障!</span></a></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">Linux系统性能优化:七个实战经验</span></a></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">17个运维常用指标,面试常问!</span></a></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">面试官:K8s Service <span style="color: black;">背面</span>是怎么工作的?</span></a></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">史上最全的 网络知识 思维导图!</span></a></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">K8s Pod 故障排查,一个不为人知的技巧!</span></a></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">大厂总结 Nginx 高并发性能优化笔记</span></a></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">Nginx+Lua+</span></a>Redis 实现灰度上线系统</p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">基于 Jenkins 搭建一套 CI/CD 系统</span></a></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">Linux运维工程师频繁<span style="color: black;">运用</span>的10款工具</span></a></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">Nginx 七大应用场景(附配置)</span></a></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">全网最全 Linux 命令总结,<span style="color: black;">意见</span><span style="color: black;">保藏</span>!</span></a></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">猪八戒网 CI/CD 实践总结</span></a></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;">16 张图硬核讲解Kubernetes网络</span></a></p><a style="color: black;"><span style="color: black;">得物App全栈 DevOps 可观测</span></a>平台落地实践<a style="color: black;"><span style="color: black;">神器 Nginx 的学习手册 ( <span style="color: black;">意见</span><span style="color: black;">保藏</span> )</span></a><a style="color: black;"><span style="color: black;">19 个 K8S集群<span style="color: black;">平常</span>问题总结,<span style="color: black;">意见</span><span style="color: black;">保藏</span></span></a><a style="color: black;"><span style="color: black;">9 个实用 Shell 脚本,<span style="color: black;">意见</span><span style="color: black;">保藏</span>!</span></a><a style="color: black;"><span style="color: black;">K8S运维必知必会的 Kubectl 命令</span></a><a style="color: black;"><span style="color: black;">史上最全 Jenkins Pipeline流水线详解</span></a><a style="color: black;"><span style="color: black;">主流监控系统 Prometheus 学习指南</span></a><a style="color: black;"><span style="color: black;">40个 Nginx 常</span></a>问面试题
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><a style="color: black;"><span style="color: black;"><span style="color: black;">平常</span>Linux运维面试题,找工作的必看!</span></a></p><a style="color: black;"><span style="color: black;">Linux运维工程师 50个<span style="color: black;">平常</span>面试题</span></a><img src="data:image/svg+xml,%3C%3Fxml version=1.0 encoding=UTF-8%3F%3E%3Csvg width=1px height=1px viewBox=0 0 1 1 version=1.1 xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink%3E%3Ctitle%3E%3C/title%3E%3Cg stroke=none stroke-width=1 fill=none fill-rule=evenodd fill-opacity=0%3E%3Cg transform=translate(-249.000000, -126.000000) fill=%23FFFFFF%3E%3Crect x=249 y=126 width=1 height=1%3E%3C/rect%3E%3C/g%3E%3C/g%3E%3C/svg%3E" style="width: 50%; margin-bottom: 20px;">
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">点亮,服务器三年不宕机<img src="data:image/svg+xml,%3C%3Fxml version=1.0 encoding=UTF-8%3F%3E%3Csvg width=1px height=1px viewBox=0 0 1 1 version=1.1 xmlns=http://www.w3.org/2000/svg xmlns:xlink=http://www.w3.org/1999/xlink%3E%3Ctitle%3E%3C/title%3E%3Cg stroke=none stroke-width=1 fill=none fill-rule=evenodd fill-opacity=0%3E%3Cg transform=translate(-249.000000, -126.000000) fill=%23FFFFFF%3E%3Crect x=249 y=126 width=1 height=1%3E%3C/rect%3E%3C/g%3E%3C/g%3E%3C/svg%3E" style="width: 50%; margin-bottom: 20px;"></span></p>
页:
[1]