Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to turn on gzip compression for symfony2 site?

Tags:

symfony

I am using servergrove for my site hosting but they sure lack staff that would help me. How do I setup gzip compression for symfony2 site?

If possible, in an idiot-proof way as I have no knowledge of linux.

like image 767
Zeljko Avatar asked Apr 01 '13 14:04

Zeljko


People also ask

How to add gzip Compression to a website?

Gzip on Windows Servers (IIS Manager)Open up IIS Manager. Click on the site you want to enable compression for. Click on Compression (under IIS) Now Enable static compression and you are done!

How do I gzip a javascript file?

To check if your apache server has already output compression enabled, put the example above into an . htaccess file. Then load an html or js file via the server and check the headers for "Content-Encoding", if it says gzip or deflate, it is enabled.

How do I turn off GZIP compression?

To disable gzip compression, open the corresponding file in a text editor and change gzip on to gzip off . Save the changes and close the file.


1 Answers

I add the following into my .htaccess in the web folder.

<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/css
    AddOutputFilterByType DEFLATE text/javascript
    AddOutputFilterByType DEFLATE application/x-javascript
    AddOutputFilterByType DEFLATE application/javascript
    AddOutputFilterByType DEFLATE text/x-component
    AddOutputFilterByType DEFLATE text/html
    AddOutputFilterByType DEFLATE text/richtext
    AddOutputFilterByType DEFLATE image/svg+xml
    AddOutputFilterByType DEFLATE text/plain
    AddOutputFilterByType DEFLATE text/xsd
    AddOutputFilterByType DEFLATE text/xsl
    AddOutputFilterByType DEFLATE text/xml
    AddOutputFilterByType DEFLATE image/x-icon
    AddOutputFilterByType DEFLATE application/json
</IfModule>

Can't remember for the life of me where I originally got it from.

like image 151
qooplmao Avatar answered Oct 04 '22 04:10

qooplmao