apache

  1. 打开gzip压缩
  2. 设置kalive时间和最大次数
  3. 设置mpm_winnt_module 数量
  4. 设置日志按天存储
LogLevel crit

#ErrorLog logs/error.log
ErrorLog "|/usr/sbin/rotatelogs /var/log/httpd/error_log%Y%m%d.log 86400 480"

#CustomLog logs/access.log combined
CustomLog "|/usr/sbin/rotatelogs /var/log/httpd/access_log%Y%m%d.log 86400 480" common
  • 修改最大连接数
httpd -l #查看使用了什么mpm模块
#修改介绍
https://codeplayer.vip/p/j7sc9

#windows
<IfModule mpm_winnt_module>
    ThreadsPerChild      1920
    MaxRequestsPerChild    0
</IfModule>

#centos 8
<IfModule mpm_event_module>
   #ServerLimit    160  #默认系统限制16
    StartServers             10 #启动进程数
    MinSpareThreads         200 #空闲的最小线程数
    #MaxSpareThreads        10000  #空闲的最大线程数
    ThreadsPerChild         25  #固定的工作线程数 StartServers*ThreadsPerChild
    MaxConnectionsPerChild   0   #进程最大请求数
</IfModule>

/extra/http-default.conf

MaxKeepAliveRequests 10000 #加大请求次数
KeepAliveTimeout 30  #加长keep超时时间
ServerTokens Prod #头只显示apache不显示版本