# Setting up Nginx to and enabling Gzip compression on Amazon EC2
In this article we will learn how to setup Nginx and how to enable gzip compression for reducing the size of files to be transmitted.
# Set Up Reverse Proxy Server - Nginx
Firstly we need to install on the web server, the epel-release package using yum, (it might be installed on some servers by default)
sudo yum install epel-release
Next, we will install Nginx
sudo yum install nginx
# Enabling Gzip
Gzip is a popular data compression program which is a part of Nginx but needs to be enabled and configured. It helps reduce the size of the files being tranferred, thus making a website load faster.
In nginx all files with the .conf extension from from the
/etc/nginx/conf.d directory are automatically loaded. So that we can easily configure additional modules.
So for Gzip we will create a conf file called gzip.conf using nano editor in the directory
etc/nginx/conf.d/, So navigate to this directory and run the commmand :
sudo nano gzip.conf
And paste the following content in the file.
Save (CTRL+O then enter) the file and exit the editor (CTRL+X).
sudo service nginx restart
- Setting up Nginx to and enabling Gzip compression on Amazon EC2