设为首页 收藏本站
查看: 1189|回复: 0

[经验分享] Nginx基本优化一

[复制链接]

尚未签到

发表于 2017-12-22 12:20:31 | 显示全部楼层 |阅读模式
fastcgi_connect_timeout  Syntax: fastcgi_connect_timeout time;
  Default: fastcgi_connect_timeout 60s;
  Context: http, server, location
  Defines a timeout for establishing a connection with a FastCGI server. It should be noted that this timeout cannot usually exceed 75 seconds.
  表示nginx服务器和后端fastcgi服务器服务器连接的超时时间默认60s,这个参数值通常不要超过75s,因为建立的连接越多消耗的资源就越多
  fastcgi_send_timeout
  Syntax: fastcgi_send_timeout time;
  Default: fastcgi_send_timeout 60s;
  Context: http, server, location
  Sets a timeout for transmitting a request to the FastCGI server. The timeout is set only between two successive write operations, not for the transmission of the whole request.
  If the FastCGI server does not receive anything within this time, the connection is closed.
  设置nginx允许fastcgi服务器端返回数据的超时时间,即在规定时间之内后端服务器必须传完所有数据,否则,nginx将断开这个连接,默认为60s
  fastcgi_read_timeout
  Syntax: fastcgi_read_timeout time;
  Default: fastcgi_read_timeout 60s;
  Context: http, server, location
  Defines a timeout for reading a response from the FastCGI server. The timeout is set only between two successive read operations, not for the transmission of the whole response.
  If the FastCGI server does not transmit anything within this time, the connection is closed.
  设置nginx从fastcgi服务器端读取响应信息的超时时间,表示连接建立成功后,nginx等待后端服务器的响应时间,是nginx已经进入后端的排队之中等待处理的时间
  fastcgi_buffer_size

  Syntax: fastcgi_buffer_size>  Default: fastcgi_buffer_size 4k|8k;
  Context: http, server, location

  Sets the>
  By default, the buffer>  这个是nginx fastcgi的缓冲区大小参数,设定用来读取从fastcgi服务器收到的第一部分响应信息的缓冲区大小,这里的第一部分通常会包含一个小的响应头部,默认情况,这个参数的大小是由fastcgi_buffers指定的一个缓冲区大小。
  fastcgi_buffers

  Syntax: fastcgi_buffers number>  Default: fastcgi_buffers 8 4k|8k;
  Context: http, server, location

  Sets the number and>
  By default, the buffer>  指定本地需要用多少和多大的缓冲区来缓冲FastCGI的应答请求。如果一个PHP脚本所产生的页面大小为256KB,那么会为其分配4个64KB的缓冲区来缓存;
  如果页面大小大于256KB,那么大于256KB的部分会缓存到fastcgi_temp指定的路径中,但是这并不是好方法,因为内存中的数据处理速度要快于硬盘。
  一般这个值应该为站点中PHP脚本所产生的页面大小的中间值,如果站点大部分脚本所产生的页面大小为256KB,那么可以把这个值设置为“16 16k”、“4 64k”等。
  fastcgi_busy_buffers_size

  Syntax: fastcgi_busy_buffers_size>  Default: fastcgi_busy_buffers_size 8k|16k;
  Context: http, server, location

  When buffering of responses from the FastCGI server is enabled, limits the total>  In the meantime, the rest of the buffers can be used for reading the response and, if needed, buffering part of the response to a temporary file.

  By default,>  fastcgi_temp_file_write_size

  Syntax: fastcgi_temp_file_write_size>  Default: fastcgi_temp_file_write_size 8k|16k;
  Context: http, server, location

  Limits the>
  By default,>  fastcgi_temp_path
  Syntax: fastcgi_temp_path path [level1 [level2 [level3]]];
  Default: fastcgi_temp_path fastcgi_temp;
  Context: http, server, location
  Defines a directory for storing temporary files with data received from FastCGI servers. Up to three-level subdirectory hierarchy can be used underneath the specified directory.
  For example, in the following configuration  fastcgi_temp_path /spool/nginx/fastcgi_temp 1 2;
  a temporary file might look like this:
  /spool/nginx/fastcgi_temp/7/45/00000123457
  See also the use_temp_path parameter of the fastcgi_cache_path directive.
  fastcgi_connect_timeout 300;
  fastcgi_send_timeout 300;
  fastcgi_read_timeout 300;
  fastcgi_buffer_size 64k;
  fastcgi_buffers 4 64k;
  fastcgi_busy_buffers_size 128k;
  fastcgi_temp_file_write_size 128k;
  fastcgi_temp_path /usr/local/nginx/fastcgi_tmp 1 2;
  fastcgi_cache(buffer一份给用户,一份写到缓存)
  表示开启FastCGI缓存并为其指定一个名称。开启缓存非常有用,可以有效降低CPU的负载,并且防止502错误的发生,但是开启缓存也会引起很多问题,要视具体情况而定。
  为FastCGI缓存指定一个文件路径、目录结构等级、关键字区域存储时间和非活动删除时间
  Syntax: fastcgi_cache_path path [levels=levels] [use_temp_path=on|off] keys_zone=name:size [inactive=time] [max_size=size]
[manager_files=number] [manager_sleep=time] [manager_threshold=time] [loader_files=number] [loader_sleep=time]

[loader_threshold=time] [purger=on|off] [purger_files=number] [purger_sleep=time] [purger_threshold=time];

  Default: —
  Context: http

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-426807-1-1.html 上篇帖子: NGINX中的proxy 下篇帖子: 解析 Nginx 负载均衡策略
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表