Advance

Introducing and Enable Brotli Compression on Apache

Introducing and Enable Brotli Compression on Apache
0
(0)

Images, fonts, and other media can take up a lot of space on your website and drastically slow down the download. When a large website uses a large number of blog posts and other pages, you may find that your images and media folders are full of content. The point to keep in mind is that if these sites get out of control, they can quickly damage the site. But you do not have to deal with a lot of download time and lost visitors forever. Therefore, using a compression algorithm can help improve image delivery and file transfer through your server and speed up your website. In this article, we are going to teach you about Introducing and Enable Brotli Compression on Apache. You can visit the packages available in Eldernode if you wish to purchase a VPS Hosting Server.

Introduction to Brotli Compression

Data compression is the process of encrypting files to reduce their size, which takes up less space on your server and transmits to site visitors faster. Image, audio, and video compression are very common, but you can compress almost any type of data, including code. There are different algorithms for it.

Google has always tried to minimize the web and make it more accessible. Especially for people who are on mobile devices and can not manage a lot of data. Brotli Compression was created by Google to further reduce web page load time.

In the next section, we will discuss some applications of Brotli compression. Then we will teach you how to install and enable Brotli Compression on Apache. Please stay tuned for the rest of this article.

Recommended Article: How to install Axel on Linux

Applications of Brotli Compression

Brotli has a general application so it can compress any type of file without destroying the data. However, it is not suitable for image files such as PNG, JPG, and GIF. These types of files are already compressed, and Brotli actually makes them bigger. You can try an image compression plugin instead.

In the past, Google created Zopfli. An algorithm that, although quite powerful and capable of achieving a high level of data density, was very slow. While decompression is fast and will not affect end users, compression lasts forever.

There are other applications, such as Gzip, that have long been the gold standard for lightweight compression, but Brotli is faster. It is 20-26% faster than the Zopfli, although it uses the same powerful technology. It also offers more compact compression than similar algorithms. In addition, Brotli is widely supported and its use is free for everyone.

Prerequisites for installing Brotli Compression on Apache

_ Ability to access the server with a Sudo privileged account

_ An Apache server

_ Create a virtual host for the web application

How to Install Brotli Compression on Apache

In this section, we are going to teach you how to enable Brotli Compression on Apache. Doing this is not a complicated task. You can follow the steps below to do this.

Just install the Brotli package on your system using the following command. It should be noted that for Ubuntu and Debian systems, it is available in the default repositories.

sudo apt install brotli -y

In the next section, join us to teach you how to configure Brotli.

How to Enable Brotli with Apache

In this section, we are going to teach you how to configure Brotli. Note that the Apache server contains the default Brotli module. Therefore, you need to enable the Brotli module in Apache using the following command:

sudo a2enmod brotli

You now need to configure the Apache virtual host by adding the following code to the virtual host configuration file. Doing so will enable Brotli compression:

<IfModule mod_brotli.c>  AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/xml text/css text/javascript application/javascript  </IfModule>

After making the mentioned changes, you can now save the configuration file and close it. It should be noted that you can reload the Apache service using the following command to apply the changes:

sudo systemctl restart apache2

You can access your web application in your desired browser and check headers value in the browser console. To do this, just search for Content-Encoding value. Note that this must contain br as a value. br shows the web page is compressed by Brotli compression.

You can also use the curl command to access the header values as below in the command line:

curl -I -H 'Accept-Encoding: br' http://example.com
Recommended Article: How to Configure Bower on ubuntu 20 ubuntu 18

Conclusion

Enabling Brotli Compression means that your site files are shrinking and moving faster to visitor devices. Even someone with a slow internet connection or a mobile device with limited bandwidth can easily download your site. In this article, we tried to teach you how to Enable Brotli Compression on Apache after the complete introduction of Brotli compression.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

Leave a Reply

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

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way

+8595670151

7 days a week, 24 hours a day