Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I've used something like this before for js/css files (I modified the below to match your needs). Add this to your virtualhost entry:</p> <pre><code>Alias /doc/ "/usr/share/doc/" Alias local.doc "/usr/share/doc/" &lt;Directory /usr/share/doc&gt; Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 AddEncoding gzip gz &lt;FilesMatch "\.gz$"&gt; ForceType text/plain Header set Content-Encoding: gzip &lt;/FilesMatch&gt; &lt;/Directory&gt; </code></pre> <p>Updated above to match your code</p> <p>In ubuntu ensure that Headers module is enabled </p> <pre><code>$ sudo a2enmod headers $ sudo a2enmod deflate $ sudo apache2ctl restart </code></pre> <p>Update2: Realized that "AddEncoding gzip gz" was missing.. otherwise, file kept trying to download.</p> <p>Update3: Added apache module deflate install command. Here's my deflate.conf:</p> <pre><code>&lt;IfModule mod_deflate.c&gt; # these are known to be safe with MSIE 6 AddOutputFilterByType DEFLATE text/html text/plain text/xml # everything else may cause problems with MSIE 6 AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE application/x-javascript application/javascript application/ecmascript AddOutputFilterByType DEFLATE application/rss+xml &lt;/IfModule&gt; </code></pre> <p>You could first try with some other type of file (e.g. a css file). Example:</p> <pre><code>cd /usr/share/doc cat ".styles { width: 50px; }" &gt; test.css gzip -c test.css &gt; test.css.gz </code></pre> <p>Add this to your virtualhost:</p> <pre><code> &lt;FilesMatch "\.css\.gz$"&gt; ForceType text/css Header set Content-Encoding: gzip &lt;/FilesMatch&gt; </code></pre> <p>Test <a href="http://127.0.0.1/doc/test.css" rel="noreferrer">http://127.0.0.1/doc/test.css</a> and <a href="http://127.0.0.1/doc/test.css.gz" rel="noreferrer">http://127.0.0.1/doc/test.css.gz</a> and see what result you get.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload