Ubuntu 14 server problem with joomla (jbetolo) gzipped files

Hi all,

I have a VPS with Linode and I have installed all the software necessary (mysql, apache2, php5) on Ubuntu 14.04 x64 to host joomla and wordpress websites. Wordpress websites work fine, even with W3 Total Cache's minify settings on.

Example:

A minified JS resource from my wordpress site

http://salvatoremarchetti.com/alukal/wp … bhc_PFw.js">http://salvatoremarchetti.com/alukal/wp-content/cache/minify/000000/jY5BDsIwDAQVDfqi5BJrMhgJ23stILXEygXbpxWWu1oZwnGTmsjM9AuzsIldxSIamG04WZB8F1lAiOh6LVNKP2OEo4VuETp6dzdtk7t8Y1NqCcGzrNymVawlFrrKrUIv24BDQj-ARm18OTpl8AIqZIwhvnRMqcEQXmsx3gkcr0KB04BUZi6l7jQcOBebhc_PFw.js

The problem is on the Joomla site with jbetolo installed. The configuration.php has the setting: public $gzip = '1';

However the gzipped resources in the source code do not work. When accessed they throw a "Restricted access" error.

Example:

Not working example of new site

http://www.salvatoremarchetti.com/inasi … ag=5184000">http://www.salvatoremarchetti.com/inasia/index.php?option=com_jbetolo&task=serve&gz=1&file=5175fb22261da0a0d8d54a9b8e645351.js&type=js&ag=5184000

This site is a clone of the original site (a shared server which I will have to leave soon) where the same resource works perfectly.

Working example on original site:

http://www.associazioneculturaleinasia. … ag=5184000">http://www.associazioneculturaleinasia.it/index.php?option=com_jbetolo&task=serve&gz=1&file=f5d7e192be8280b08cdcd16ecaa1b05b.js&type=js&ag=5184000

On the VPS server where I have problems I have used the following commands to install zlib and zip:

In /etc/apt/sources.list I added to the bottom: deb http://us.archive.ubuntu.com/ubuntu saucy main universe

sudo apt-get update && sudo apt-get upgrade

sudo apt-get install zlibc zlib1g zlib1g-dev zlib-bin libgcrypt11-dev

sudo nano /etc/php5/apache2/php.ini

(here I made the following changes)

zlib.output_compression = On

zlib.outputcompressionlevel = -1

implicit_flush = Off

cgi.fix_pathinfo = 1

extension=zip.so

sudo apt-get install apache2-mpm-worker libapache2-mod-fastcgi php5-fpm

sudo a2enmod actions alias fastcgi

Then in /etc/apache2/mods-enabled/fastcgi.conf

I inserted:

AddHandler php5-fcgi .php

Action php5-fcgi /php5-fcgi

Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi

FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization

sudo service apache2 restart && sudo service php5-fpm restart

sudo mkdir /var/www/cgi-bin

sudo touch /var/www/cgi-bin/php5.fcgi

sudo chown -R www-data:www-data /var/www/cgi-bin

sudo nano /etc/apache2/mods-enabled/fastcgi.conf

This file currently looks like this:

AddHandler fastcgi-script .fcgi

FastCgiWrapper /usr/lib/apache2/suexec

FastCgiIpcDir /var/lib/apache2/fastcgi

Alias /php5.fcgi /var/www/cgi-bin/php5.fcgi

AddType application/x-httpd-fastphp5 .php

Action application/x-httpd-fastphp5 /php5.fcgi

FastCGIExternalServer /var/www/cgi-bin/php5.fcgi -socket /var/run/php5-fpm.sock

Order allow,deny

Order deny,allow

and changed my conf file: /etc/apache2/sites-available/salvatoremarchetti.com.conf

domain: salvatoremarchetti.com

public: /home/myusername/public/salvatoremarchetti.com/

# Admin email, Server Name (domain name), and any aliases

ServerAdmin webmaster@salvatoremarchetti.com

ServerName salvatoremarchetti.com

ServerAlias salvatoremarchetti.com

ServerAlias http://www.salvatoremarchetti.com

Index file and Document Root (where the public files are located)

DirectoryIndex index.html index.php index.htm

DocumentRoot /home/myusername/public/salvatoremarchetti.com/public

Options Indexes FollowSymLinks MultiViews

AllowOverride all

Order allow,deny

Allow from all

Require all granted

Log file locations

LogLevel warn

ErrorLog /home/myusername/public/salvatoremarchetti.com/log/error.log

CustomLog /home/myusername/public/salvatoremarchetti.com/log/access.log combined

ExpiresActive on

ExpiresByType image/jpg "access plus 60 days"

ExpiresByType image/png "access plus 60 days"

ExpiresByType image/gif "access plus 60 days"

ExpiresByType image/jpeg "access plus 60 days"

ExpiresByType text/css "access plus 1 days"

ExpiresByType image/x-icon "access plus 1 month"

ExpiresByType text/javascript "access plus 1 week"

ExpiresByType application/x-javascript "access plus 1 week"

ExpiresByType application/javascript "access plus 1 week"

After that I did this:

sudo a2enmod deflate

At the bottom of: /etc/apache2/apache2.conf I added: Include httpd.conf

I created an empty httpd.conf file in /etc/apache2/httpd.conf

and pasted in it:

LoadModule deflatemodule modules/moddeflate.so

sudo ln -s /etc/apache2/mods-available/deflate.load /etc/apache2/mods-enabled/

sudo service apache2 restart

It is obvious that somewhere along the line I have made a huge mess of it all. I have a feeling that if I uninstalled this bit and reinstalled it in some other way it would work but I don't know what the problem is and don't know how to solve it.

Any help will be appreciated.

thanks in advance

6 Replies

I could be wrong in this, and I don't have a lot of experience with Joomla's functionality specifically, but I believe you need to add output filters (AddOutputFilterByType) in your .htaccess for Joomla and mod_deflate to work together.

http://httpd.apache.org/docs/2.4/mod/mod_deflate.html

I'm sure the following will work appropriately (and it's the default suggested by Apache in Apache 2.4), but you can add more if necessary:

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript

I also believe you need the mod_filter module to run those filters in the .htaccess.

Let us know how you fare,

Dave.

This is my .htacces

What do you think? Anything missing?

Patched on: %2014-%05-%15 %12:%May:%48

Auto-patched by jbetolo

FileETag none

ExpiresActive On

ExpiresDefault A600

ExpiresByType image/x-icon A5184000

ExpiresByType application/x-javascript A5184000

ExpiresByType application/javascript A5184000

ExpiresByType text/css A5184000

ExpiresByType text/javascript A5184000

ExpiresByType image/gif A5184000

ExpiresByType image/png A5184000

ExpiresByType image/jpeg A5184000

ExpiresByType text/plain A86400

ExpiresByType application/x-shockwave-flash A5184000

ExpiresByType video/x-flv A5184000

ExpiresByType application/pdf A5184000

ExpiresByType text/html A600

Options +FollowSymLinks

Mod_rewrite in use.

RewriteEngine On

AddType video/ogg .ogv

AddType audio/ogg .ogg

AddType video/mp4 .mp4

AddType video/webm .webm

AddType audio/webm .weba

AddType text/plain .srt

Begin - Rewrite rules to block out some common exploits.

If you experience problems on your site block out the operations listed below

This attempts to block the most common type of exploit attempts to Joomla!

#

Block out any script trying to base64_encode data within the URL.

RewriteCond %{QUERYSTRING} base64encode[^(]([^)]) [OR]

Block out any script that includes a

Do you have mod_filter enabled/installed?

EDIT: Can you show the output of 'apache2ctl -M'? This will show which modules you have installed and enabled.

Thanks,

Dave.

Thanks for the message

How do I check this?

As per my edit, run apache2ctl -M on your Linode's command line as root.

Thanks,

Dave.

Loaded Modules:

core_module (static)

so_module (static)

watchdog_module (static)

http_module (static)

logconfigmodule (static)

logio_module (static)

version_module (static)

unixd_module (static)

accesscompatmodule (shared)

actions_module (shared)

alias_module (shared)

authbasicmodule (shared)

authdigestmodule (shared)

authncoremodule (shared)

authnfilemodule (shared)

authzcoremodule (shared)

authzhostmodule (shared)

authzusermodule (shared)

autoindex_module (shared)

cgi_module (shared)

dav_module (shared)

davfsmodule (shared)

deflate_module (shared)

dir_module (shared)

env_module (shared)

expires_module (shared)

fastcgi_module (shared)

fcgid_module (shared)

filter_module (shared)

headers_module (shared)

include_module (shared)

mime_module (shared)

mpmpreforkmodule (shared)

negotiation_module (shared)

php5_module (shared)

python_module (shared)

rewrite_module (shared)

setenvif_module (shared)

socacheshmcbmodule (shared)

ssl_module (shared)

status_module (shared)

suexec_module (shared)

suphp_module (shared)

thanks

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct