• nginx优化


    1. user www;                                                                #安全性优化,不建议采用root
    2. pid /var/run/nginx.pid; 
    3. worker_processes 4;                                                 #建议将逻辑cpu空闲的都分给它
    4. worker_cpu_affinity    0001  0010  0100 1000;        #将逻辑核和nginx线程做绑定,这个有几个核心就有多少位
    5. worker_rlimit_nofile 100000;                                    #每个进程可以打开的文件数
    6. events { 
    7. worker_connections 2048;                                        #最大连接数
    8. multi_accept on;                                                            
    9. use epoll;                                                                   #使用非阻塞模型
    10. http { 
    11. server_tokens off; 
    12. sendfile on; 
    13. tcp_nopush on; 
    14. tcp_nodelay on; 
    15. access_log off;                                                           #关闭accesslog
    16. error_log /var/log/nginx/error.log crit;                   #error日志级别开大
    17. keepalive_timeout 10; 
    18. client_header_timeout 10; 
    19. client_body_timeout 10; 
    20. reset_timedout_connection on; 
    21. send_timeout 10; 
    22. limit_conn_zone $binary_remote_addr zone=addr:5m; 
    23. limit_conn addr 100; 
    24. include /etc/nginx/mime.types; 
    25. default_type text/html; 
    26. charset UTF-8; 
    27. gzip on; 
    28. gzip_disable "msie6"; 
    29. gzip_proxied any; 
    30. gzip_min_length 1000; 
    31. gzip_comp_level 6; 
    32. gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; 
    33. open_file_cache max=100000 inactive=20s;                    #让文件存在缓存里
    34. open_file_cache_valid 30s; 
    35. open_file_cache_min_uses 2; 
    36. open_file_cache_errors on; 
    37. include /etc/nginx/conf.d/*.conf; 
    38. include /etc/nginx/sites-enabled/*; 
  • 相关阅读:
    SpringMvc
    Spring-Aop
    Spring-IOC
    Spring模块划分
    队列
    稀疏数组
    数据结构
    Nginx配置实例
    Nginx常用命令
    视频断点播放:h5+jquery
  • 原文地址:https://www.cnblogs.com/panzhicheng/p/6666905.html
Copyright © 2020-2023  润新知