Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
litespeed_wiki:config:brotli:start [2017/10/24 12:59] Lisa Clarke |
litespeed_wiki:config:brotli:start [2020/03/31 02:20] Joshua Reynolds Merged content from other pages & revised summary |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Brotli ====== | ====== Brotli ====== | ||
- | Brotli is a compression algorithm which, much like gzip/deflate, reduces both file size and page load time. Brotli compression is supported starting in LiteSpeed Web Server v5.2 and it is currently enabled by default. | + | Brotli is a compression algorithm which, much like gzip/deflate, reduces both file size and page load time. Brotli compression is supported starting in LiteSpeed Web Server v5.2 and it is enabled by default for secure static pages and [[litespeed_wiki:cache:common:gzip-brotli-automatic-conversion|non-ESI dynamic pages]]. |
- | ===== What is Brotli? ===== | + | ===== Disabling Brotli Compression Server Wide ===== |
- | Brotli is a generic-purpose lossless-compression algorithm that compresses data using a combination of a modern variant of the LZ77 algorithm, Huffman coding and 2nd order context modeling, with a compression ratio comparable to the best currently available general-purpose compression methods. It is similar in speed with deflate but offers more dense compression.((https://github.com/google/brotli)) | + | Beginning with LiteSpeed Web Server version 5.2, brotli, a new compression method, is now supported and enabled by default. |
+ | |||
+ | **Note:** If your browser does not yet support brotli compression, LiteSpeed will automatically default back to gzip. As such, we only recommend disabling brotli if encountering issues. | ||
+ | |||
+ | While useful for reducing the size of static web pages, brotli compression can sometimes cause issues with web pages containing pre-compressed content, such as gzip-compressed PHP. In these cases it may be desirable to disable brotli server wide, which can be accomplished with the following steps. | ||
+ | |||
+ | ==== Instructions ==== | ||
+ | - Log in to the LiteSpeed WebAdmin Console\\ \\ {{ :litespeed_wiki:config:brotli:brotli-server-1.png?nolink&400 |}} | ||
+ | - Navigate to **Configuration > Server > Tuning**\\ \\ {{ :litespeed_wiki:config:brotli:brotli-server-2.png?nolink&800 |}} | ||
+ | - Scroll down to **Brotli Compression** and click **Edit**.\\ \\ {{ :litespeed_wiki:config:brotli:brotli-server-3.png?nolink&800 |}} | ||
+ | - Set **Enable Brotli Compression** to ''No''\\ \\ {{ :litespeed_wiki:config:brotli:brotli-server-4.png?nolink&800 |}} | ||
+ | - Save and perform a Graceful Restart to apply the change.\\ \\ {{ :litespeed_wiki:config:brotli:brotli-5.png?nolink&800 |}} \\ {{ :litespeed_wiki:config:brotli:brotli-6.png?nolink&800 |}} | ||
+ | |||
+ | Brotli compression should now be disabled server wide. | ||
+ | |||
+ | ===== Disable Brotli Compression on a Per Account/Domain Basis ===== | ||
+ | As of LiteSpeed Web Server v5.2.2, Brotli compression can be disabled on a per account/domain basis through Apache configuration and .htaccess files. In previous versions, Brotli could only be disabled server wide. | ||
+ | |||
+ | |||
+ | ==== LiteSpeed Web Server ==== | ||
+ | - Log in to the LSWS Web Admin GUI and navigate to **Configuration > Virtual Hosts**\\ \\ {{ :litespeed_wiki:config:brotli:brotli-1.png?nolink&800 |}} \\ | ||
+ | - Select a virtual host and click on the **General** tab\\ \\ {{ :litespeed_wiki:config:brotli:brotli-2.png?nolink&800 |}} \\ | ||
+ | - Scroll down to the **Apache Style Configurations** setting and click **Edit**\\ \\ {{ :litespeed_wiki:config:brotli:brotli-3.png?nolink&800 |}} \\ | ||
+ | - Add the following to the text box: ''SetEnv no-brotli''\\ \\ {{ :litespeed_wiki:config:brotli:brotli-4.png?nolink&800 |}} \\ | ||
+ | - Save and perform a Graceful Restart to apply these changes. The virtual host should no longer be using brotli compression.\\ \\ {{ :litespeed_wiki:config:brotli:brotli-5.png?nolink&800 |}} \\ {{ :litespeed_wiki:config:brotli:brotli-6.png?nolink&800 |}} | ||
+ | ==== cPanel/WHM ==== | ||
+ | The ‘''no-brotli''’ tag can be enabled selectively through virtual host include files, such as: | ||
+ | * Without SSL: ''/etc/apache2/conf.d/userdata/std/2_4/$USER/yourdomain.com/brotli.conf'' | ||
+ | * With SSL: ''/etc/apache2/conf.d/userdata/ssl/2_4/$USER/yourdomain.com/brotli.conf'' | ||
+ | By adding the following block: | ||
+ | <code> | ||
+ | <IfModule LiteSpeed> | ||
+ | SetEnv no-brotli | ||
+ | </IfModule> | ||
+ | </code> | ||
+ | Perform a Graceful Restart to apply these changes. The account should no longer be using brotli compression.\\ \\ | ||
+ | **Note:** For more information on how to edit virtual host include files please see [[https://documentation.cpanel.net/display/EA/Modify+Virtualhost+Containers+With+Include+Files|How To Modify Virtualhost Containers With Include Files]] in cPanel documentation. | ||
+ | ==== .htaccess ==== | ||
+ | To disable brotli compression via an ''.htaccess'' file, simply add: | ||
+ | <code> | ||
+ | SetEnv no-brotli | ||
+ | </code> | ||
+ | This method allows brotli compression to be disabled for certain sub folders/files without the need for a Graceful Restart. | ||
- | ===== Configuration ===== | ||
- | |[[litespeed_wiki:config:brotli:disable-per|Disable Brotli Per Account/Domain]]|How to disable Brotli on a per Account/Domain basis| |