Quantcast
Channel: Malaysia Wordpress, Tutorial, Security & Linux Tips » redhat
Viewing all articles
Browse latest Browse all 3

Enable GZIP Compression on Plesk, CentOS & RedHat

$
0
0

images
Enable GZIP Compression on Plesk, CentOS & RedHat. If you own a dedicated server or have a VPS server you can enable GZIP compression apache nginx on Plesk, CentOS & RedHat based operating systems. This will decrease the load time of all your customers websites, as setting this will be server wide. Having fast loading websites is essential to having a higher ranking for you, and your customers websites.

Over the last few years it has slowly gotten better (don’t worry, it still completely breaks on every version upgrade) and nowadays comes with nginx.

However, I noticed that for some obscure reason, it doesn’t enable GZip compression for the webpages it serves? This is quite odd, having myself worked a lot with nginx over the last few years, it’s a default configuration!

If you have Parallels Plesk Panel GZIP compression, it does not compress all filetypes by default. This tutorial is written on a Plesk 12 VPS server. Don’t worry, it’s quite easy to enable it though:

Symptoms
How to enable gzip support on nginx?

Resolution

Enable GZIP Compression Nginx for Plesk, CentOS or RedHat

Nginx config on CentOS
$ vi /etc/nginx/nginx.conf
Add before }

gzip on;
gzip_comp_level 9;
gzip_http_version 1.1;
gzip_proxied any;
gzip_min_length 10;
gzip_buffers 16 8k;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/xhtml+xml;

# Disable for IE < 6 because there are some known problems
gzip_disable “MSIE [1-6].(?!.*SV1)”;

# Add a vary header for downstream proxies to avoid sending cached gzipped files to IE6
gzip_vary on;

Enable GZIP Compression Nginx on CentOS, Plesk & RedHat based operating systems.

Restart Nginx and fix any errors:
$ service nginx restart

Enable GZIP Compression Apache for Plesk, CentOS, CloudLinux or RedHat

Must have mod_deflate enabled on your server. When you run this command and a # in front, you will need to edit and uncomment mod_deflate.

$ grep “mod_deflate” /etc/httpd/conf/httpd.conf

If # exists
$ vi /etc/httpd/conf/httpd.conf
and uncomment out LoadModule
#mod_deflate/LoadModule mod_deflate

Backup your apache configuration file.
$ cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.backup

Now edit your apache configuration and add the extensions you want to compress.

$vi /etc/httpd/conf/httpd.conf

Enable GZIP Compression Apache on Plesk

Add to end of file.

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

While adding this to your files, restart the service after any changes to make sure no conflicts appear, and fix as necessary.

Restart Nginx and fix any errors:
$ service nginx restart

Restart Apache and fix any errors:
$ service httpd restart

Use a HTTP Compression Tester, such as WhatsMyIp.org HTTP Compression Checker to verify HTTP Compression. If all goes successful, you will have enable gzip compression apache nginx on Plesk, CentOS & Redhat based operating systems. Essential to any web hosting company.


Copyright © 2012
This feed is for personal, non-commercial use only.
The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:
)

The post Enable GZIP Compression on Plesk, CentOS & RedHat appeared first on Malaysia Wordpress, Tutorial, Security & Linux Tips.


Viewing all articles
Browse latest Browse all 3

Trending Articles