zoukankan      html  css  js  c++  java
  • 关于优化,及项目中遇到的问题04-nginx配置

    在微服务项目中,请求超时时间主要由前端处理超时时间。后台也可以设置超时时间,但主要由客户端方处理。

    nginx 配置中,

    设置请求超时时间:keepalive_timeout  65; (请求超时时间为65S并保持长连接状态)

    events {

     worker_connections 1024;   # 单个进程允许的客户端最大连接数                                                              

    }

        #nginx优化----------------------
        #隐藏版本号
        server_tokens on;
     
        #优化服务器域名的散列表大小 
        server_names_hash_bucket_size 64;
        server_names_hash_max_size 2048;
        #开启高效文件传输模式
        sendfile on;
        #减少网络报文段数量
        #tcp_nopush on;
        #提高I/O性能
        tcp_nodelay on;
     #所有静态文件由nginx直接读取不经过tomcat或resin
    location ~ .*.(htm|html|gif|jpg|jpeg|png|bmp|swf|ioc|rar|zip|txt|flv|mid|doc|ppt|pdf|xls|mp3|wma)$
    { expires 15d; }
    location ~ .*.(js|css)?$
    { expires 1h; }
    }
    }
    #图片缓存时间设置
    location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
    {
    expires 10d; #-1 为不缓存
    }
    自古英雄出炼狱,从来富贵入凡尘。
  • 相关阅读:
    BZOJ4238:电压
    BZOJ4566:[HAOI2016]找相同字符
    BZOJ4530:[BJOI2014]大融合
    BZOJ1912:[APIO2010]patrol巡逻
    BZOJ3998:[TJOI2015]弦论
    CNBlogs 样式修改
    POJ-3321 Apple Tree 【DFS序+树状数组】
    BZOJ-2152 聪聪可可 【点分治】
    POJ-1741 Tree 【点分治】
    Treap实现名次树
  • 原文地址:https://www.cnblogs.com/yunliu0603/p/10889589.html
Copyright © 2011-2022 走看看