Re: pagespeed ignores .htaccess

157 views
Skip to first unread message

Joshua Marantz

unread,
Apr 25, 2013, 5:31:21 PM4/25/13
to mod-pagespeed-discuss
mod_pagespeed has support for .htaccess files -- we test this regularly, and is the basis for deployment at most hosting providers.  Are you sure htaccess files are enabled in Apache?

e.g.

<Directory /your_files>
  AllowOverride All
</Directory>

-Josh

Joshua Marantz

unread,
Apr 26, 2013, 8:08:17 AM4/26/13
to mod-pagespeed-discuss
mod_pagespeed adheres to the TTL at origin.  So if your client had a 1-week TTL on his image, mod_pagespeed will check for changes every week.


That can be used to refresh long-TTL assets in mod_pagespeed's cache.  Note that restarting memcached may not be sufficient, as mod_pagespeed keeps an in-memory cache as an L1 in the apache servers.

-Josh


On Fri, Apr 26, 2013 at 2:52 AM, Jeroen Beerstra <jeroen....@gmail.com> wrote:
Yes the sites in question need their .htaccess to function in the first place. Did some further testing, could this be a caching issue? Restarted memcache and after that things looked like they are supposed to, that is no trace of pagespeed on ps disabled vhosts. The problem was a client was still seeing old images he changed according to him "days ago". 


On Thursday, 25 April 2013 23:03:07 UTC+2, Jeroen Beerstra wrote:
We have: mod-pagespeed-beta-1.4.26.2-2759.x86_64

Subject says it all, mod-pagespeed completely ignores pagespeed settings in a .htaccess. This is for a vhost, and I already tried to rename pagespeed.conf to 00_pagespeed.conf to make sure the vhost (also defined in a apache conf.d .conf file) gets loaded later on. Basicly I want to selectively disable pagespeed for certain vhosts but can't, so for now no pagespeed for me :(

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Julian Matz

unread,
Mar 11, 2016, 6:58:39 AM3/11/16
to mod-pagespeed-discuss
Hey, Josh. I'm having the same issue. Did you ever find a fix?

Julian

Joshua Marantz

unread,
Mar 11, 2016, 7:24:22 AM3/11/16
to mod-pagespeed-discuss
I saw the other thread you pinged.  I'm not sure what could be the problem; this is something we test on every checkin in our development environment (ubuntu-based).  It seems likely to be related to to server configuration somehow.

Can you provide more details of your setup?

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.

Julian Matz

unread,
Mar 11, 2016, 7:59:25 AM3/11/16
to mod-pagesp...@googlegroups.com
Sure! I'm not exactly sure what to tell you, though. The installed packages are from the official Debian repo, and the apache2.conf is pretty much the default one, except that I'm including /etc/apache2/vhosts/*.conf and /etc/apache2/vhosts/options.d/*.conf at the very end of the file

# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.

# Include generic snippets of statements
IncludeOptional conf-enabled/*.conf

# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf

# Include vhosts
IncludeOptional vhosts/*.conf
IncludeOptional vhosts/options.d/*.conf

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

These conf files contain all my vhosts. There are no vhosts defined in sites-enabled/.

I'm running MPM Worker, FastCGI, PHP5-FPM, Suexec.

I know the .htaccess files are being read by the server. I tested this by using "Deny from all" to restrict directory access, and "Options +Indexes" to turn on directory listings. The vhost has "AllowOverride all" defined. I also removed the <IfModule> statement to be sure while testing, although I know the module is being loaded, since I get the HTTP ModPagespeed header.

Another thing I noticed is that if I have Pagespeed statements defined in the vhost's <Directory> directive and "ModPagespeedInheritVHostConfig off" in pagespeed.conf, Apache2 won't start, even though the syntax check is ok. I'm not entirely sure if that's expected. I did this just for testing.

If there's any more information I can give, please let me know.

Thanks!
Julian

--
You received this message because you are subscribed to a topic in the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mod-pagespeed-discuss/N3U9wmEKXuo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mod-pagespeed-di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/CAGKR%2BED2kvxx2%3D2fB%3D6NFC8BMTNrG2BmsiFgXsmbLJwrx2ZPSg%40mail.gmail.com.

Julian Matz

unread,
Mar 11, 2016, 8:49:57 AM3/11/16
to mod-pagesp...@googlegroups.com
Strange... I have the exact same issue on another server running CentOS and Apache 2.4.18.

Mod Pagespeed headers can't be turned off using .htaccess. I haven't tested any further than this.

Jeff Kaufman

unread,
Mar 11, 2016, 10:16:25 AM3/11/16
to mod-pagespeed-discuss
On Fri, Mar 11, 2016 at 7:59 AM, Julian Matz <julia...@netlink.ie> wrote:
> Another thing I noticed is that if I have Pagespeed statements defined in
> the vhost's <Directory> directive and "ModPagespeedInheritVHostConfig off"
> in pagespeed.conf, Apache2 won't start, even though the syntax check is ok.
> I'm not entirely sure if that's expected. I did this just for testing.
>

That's not expected, no. What error does Apache give when it won't start?

Julian Matz

unread,
Mar 14, 2016, 2:17:00 PM3/14/16
to mod-pagesp...@googlegroups.com
Apologies for the delay.

When ModPagespeedInheritVHostConfig is set to off and I have the following in my vhost configuration:
ModPagespeed off

Then Apache silently fails when reloading it (service apache2 reload)

And when restarting, it fails with the following error message:

[Mon Mar 14 18:02:00.838548 2016] [pagespeed:error] [pid 26365] [mod_pagespeed 1.10.33.5-0 @26365] mod_pagespeed is enabled. FileCachePath must not be empty: defn_name=/etc/apache2/vhosts/10_ipandport_xxx.xxx.xxx.xx.8080.conf defn_line_number=6 server_hostname=xxx.xxx-xxx.com port=0
AH00016: Configuration Failed

I'm assuming this happens because the ModPagespeedFileCachePath isn't set, but I would have thought this would not matter if Pagespeed is disabled.

However, upon further testing, it seems this only happens when using ModPagespeed directives in <Directory> scope. When turning it off in <VirtualHost> scope, it seems to work, without having to set the FileCache path.

Julian

--
You received this message because you are subscribed to a topic in the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mod-pagespeed-discuss/N3U9wmEKXuo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mod-pagespeed-di...@googlegroups.com.

Jeff Kaufman

unread,
Mar 14, 2016, 2:21:57 PM3/14/16
to mod-pagespeed-discuss
Can you send me an example of a config that you would expect Apache to
be able to start with, but instead Apache fails with the
"FileCachePath must not be empty" error?
> You received this message because you are subscribed to the Google Groups
> "mod-pagespeed-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mod-pagespeed-di...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/mod-pagespeed-discuss/CAHtPcCV7J1Nhf0Fg5fMUNgoYR5OJKLQ669f1E9t03s1%2B10yUbQ%40mail.gmail.com.

Julian Matz

unread,
Mar 15, 2016, 8:32:56 AM3/15/16
to mod-pagesp...@googlegroups.com
Sure! This is the conf file that failed (if the "ModPagespeed off" statement is moved from the <Directory> directive straight into the <VirtualHost> directive, it works):

# Created 14.03.2016 19:27
# Do NOT manually edit this file, all changes will be deleted after the next domain change at the panel.

Listen xxx.xxx.xxx.xx:8080
<VirtualHost xxx.xxx.xxx.xx:8080>
DocumentRoot "/var/www/xxx/"
 ServerName alpha.xxx-xxx.com
  FastCgiExternalServer /var/www/php-fpm/panel/alpha.xxx-xxx.com/af6f.ssl-fpm.external -socket /var/lib/apache2/fastcgi/panel-alpha.xxx-xxx.com-php-fpm.socket -idle-timeout 60
  <Directory "/var/www/xxx/">
   <FilesMatch "\.(php)$">
     AddHandler php5-fastcgi .php
     Action php5-fastcgi /fastcgiphp
      Options +ExecCGI
    </FilesMatch>
    Require all granted
  </Directory>
  Alias /fastcgiphp /var/www/php-fpm/panel/alpha.xxx-xxx.com/af6f.ssl-fpm.external
<FilesMatch "\.(php)$">
    SetHandler php5-fastcgi
</FilesMatch>

<Directory /var/www/xxx>
    ModPagespeed off
</Directory>

 SSLEngine On
 SSLProtocol ALL -SSLv2 -SSLv3
 SSLHonorCipherOrder On
 SSLCipherSuite ECDH+AESGCM:ECDH+AES256:!aNULL:!MD5:!DSS:!DH:!AES128
 SSLVerifyDepth 10
 SSLCertificateFile /etc/ssl/localcerts/server.crt
 SSLCertificateKeyFile /etc/ssl/localcerts/server.key
 SSLCACertificateFile /etc/ssl/localcerts/server.ca-bundle
  SSLCertificateChainFile /etc/ssl/localcerts/server.ca-bundle
</VirtualHost>

Jeff Kaufman

unread,
Mar 15, 2016, 9:39:03 AM3/15/16
to mod-pagespeed-discuss
Thanks!

It's a little strange looking to me to have two <Directory
/var/www/xxx> blocks, but testing now that doesn't seem to confuse
PageSpeed.

Do you have a ModPagespeedFileCachePath directive anywhere in your config?
> https://groups.google.com/d/msgid/mod-pagespeed-discuss/CAHtPcCU6OJsQw%2Bi70Ee7806SHEh14i6r_FfEpZ1-6LsnSuWebw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages