This brief guide shows how to add Brotli compression support on Apache on Ubuntu Linux. If you are a beginner or a new user and want to add Brotli support for Apache on your ubuntu Linux machine then this short tutorial is useful and handy for you.
Brotli is an open source lossless compression algorithm developed by Google. It works best for text compression and also alternative to Gzip, Zopfli and Deflate.
Brotli fully support Apache Web Server. If you plan to use Brotli with Apache on Ubuntu then you will need to enable Apache brotli module.
Ubuntu is a Linux Operating System based on Debian and mostly composed of non-profit(free) and open-source software. It is a complete Linux operating system that compatible with desktops, laptops, server and other devices. Ubuntu is Open Source so it is freely available for both community and professional support.
if you are a learner and looking for a Linux distribution for Learning then Ubuntu Linux Operating System is best for you as a beginning.
When you are ready, follow the steps below to add Brotli Compression Support on Apache:
Brotli compression support requires SSL certificate. You will need to install SSL certificate with Apache in order to use Brotli.
In this tutorial, we are going to install and use Let’s Encrypt SSL Certificate on Ubuntu Linux with Apache.
Let’s Encrypt is a certificate authority that provides non-profit and Free SSL/Transport Layer Security encryption(TLS) certificate. This authority run and managed by Internet Security Research Group (ISRG).
To install and use Let’s Encrypt free SSL certificates on Ubuntu Linux with Apache, simply click on the link below:
Run the commands below to install Apache2 HTTP on Ubuntu server:
sudo apt update
sudo apt install apache2
Next, run the commands below to stop, start and enable Apache2 service to always start up with the server boots:
sudo systemctl stop apache2.service
sudo systemctl start apache2.service
sudo systemctl enable apache2.service
For check if Apache2 server is installed or not, simply open your browser and type server IP or hostname.
If browser show result similar like below then Apache2 is installed and working properly.
http://localhost
For the Ubuntu users, Brotli package is available in the Ubuntu official repository. So open the terminal and run the command below to install Brotli :
sudo apt install brotli
The command above will install the Brotli package in your Ubuntu Linux system.
sudo a2enmod brotli
Next, add the below code in the Apache virtual host configuration file to enable compression with Brotli support:
AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/xml text/css text/javascript application/javascript
After adding the configuration settings, the Virtual host configuration file looks similar like below:
ServerAdmin admin@example.com
ServerName example.com
DocumentRoot /var/www/
AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/xml text/css text/javascript application/javascript
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Restart the Apache service to apply the changes by using the command below:
sudo systemctl restart apache2
You can use the curl command to test Brotli support:
curl -I -H 'Accept-Encoding: br' http://example.com
Replace the example.com with your own domain.
That’s all
If you face any error and issue in above steps , please use comment box below to report.
If our article helps you, please consider buying us a coffee
Thank you for your support.
The post How to Add Brotli Compression Support on Apache appeared first on Linux Tutorial Hub.
Welcome to the Ubuntu Weekly Newsletter, Issue 873 for the week of December 29, 2024…
Have WiFi troubles on your Ubuntu 24.04 system? Don’t worry, you’re not alone. WiFi problems…
The following is a post from Mark Shuttleworth on the Ubuntu Discourse instance. For more…
I don’t like my prompt, i want to change it. it has my username and…
Introduction: A Fragile Trust The Ruby ecosystem relies heavily on RubyGems.org as the central platform…
Asset management is the process of managing and maintaining a company’s assets to maximize their…