How can I enable keep-alive?

后端 未结 6 1084
醉酒成梦
醉酒成梦 2020-12-28 13:21

I ran a Google Page Speed and it says I scored 57/100 because I need to \"Enable Keep-Alive\" and \"Enable Compression\". I did some Google searches but I c

6条回答
  •  醉梦人生
    2020-12-28 14:09

    I had the same problem and after a bit of research I found that the two most popular ways to do it are:

    1. If you do not have access to your webserver config file you can add HTTP headers yourself using a .htaccess file by adding this line of code:

      Header set Connection keep-alive

    2. If you are able to access your Apache config file, you can turn on keep-alive there by changing these 3 lines in httpd.conf file found here /etc/httpd/conf/

      KeepAlive On

      MaxKeepAliveRequests 0

      KeepAliveTimeout 100

    You can read more from this source which explains it better than me https://varvy.com/pagespeed/keep-alive.html

提交回复
热议问题