.htaccess GZIP Compression & Enable Keep-alive

Read Time:52 Second

To make faster webpage loading, use Gzip compress and Enable keep-alive in htaccess

<ifModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</ifModule>

<ifModule mod_headers.c> 
	Header set Connection keep-alive 
</ifModule>

 

In Plesk Control Panel, follow below steps

  1. Access SSH as root user
  2. Go to /var/www/vhosts/{domain}/conf
  3. Create or Modify vhosts.conf
  4. Add following code
    #
    # KeepAlive: Whether or not to allow persistent connections (more than
    # one request per connection). Set to "Off" to deactivate.
    #
    KeepAlive On
    
    #
    # MaxKeepAliveRequests: The maximum number of requests to allow
    # during a persistent connection. Set to 0 to allow an unlimited amount.
    # We recommend you leave this number high, for maximum performance.
    #
    MaxKeepAliveRequests 30
    
    #
    # KeepAliveTimeout: Number of seconds to wait for the next request from the
    # same client on the same connection.
    #
    KeepAliveTimeout 2

     

  5. Execute following command in shell
    /usr/local/psa/admin/sbin/httpdmng --reconfigure-domain <domain_name>

     

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.