Mod_pagespeed works with ip but not domain

Keywords: LAMP/MAMP/WAMP - AWS - Technical issue - Plugins installation/configuration

bnsupport ID: f790eee9-1b58-1798-ffcd-4b4c200aa5fe

bndiagnostic output:

? Apache: Found possible issues
? Resources: Found possible issues
https://docs.bitnami.com/general/apps/wordpress/troubleshooting/debug-errors-apache/
https://docs.bitnami.com/installer/faq/linux-faq/administration/increase-memory-linux/

bndiagnostic failure reason: The tool could not find any issue

Description:
Hi.
I am trying to enable mod_pagespeed, but the files are only being cached when visiting the site by ip. When visiting the site by the actual domain no files are cached.
I believe it is related to SSL but I have tried every possible path for “ModPagespeedSslCertDirectory” in the pagespeed.conf.

I have my letsencrypt SSL´s located in:
/opt/bitnami/letsencrypt/certificates/

Any help would be appreciated.

Hello @steve_san,

Could you please take a look at this previous case:

I hope it helps

Hi David, thank you for your reply.

Yes i have read that thread, but he had another problem with cached files showing “http” instead of “https”. My problem is that files are not being cached at all on https.

I tested a little bit more after i wrote this thread and I turned of https for the domain temporarily and then “pagespeed_mod” worked, it also worked when i turned on https again until i flushed the cache. Then it didnt generate new files until switching off https again.

I have an older bitnami instance running as well where the Pagespeed SSL directory is pointed to a folder with a ca-bundle-file. On that server the pagespeed works. On the newer instances it is not clear which is the right ssl-folder and bundle file.

Hello @steve_san,

Looking at your instance’s config, it seems you have your certificates at opt/bitnami/apps/letsencrypt instead of /opt/bitnami/letsencrypt/. I’m not sure why this is, are you using an old version of our bncert-tool or have you copied the files from your old instance? Regardless of why, the issue should be coming from the symlink used to make a copy of the SSL files pointing to the wrong path:

ls -la /opt/bitnami/apache/conf

lrwxrwxrwx  1 root    root        54 Jan  3 00:32 yourdomain.se.crt -> /opt/bitnami/letsencrypt/certificates/yourdomain.se.crt
lrwxrwxrwx  1 root    root        54 Jan  3 00:32 yourdomain.se.key -> /opt/bitnami/letsencrypt/certificates/yourdomain.se.key

To solve this, you just need to remove the current symlink and create a new one using the correct path:

cd /opt/bitnami/apache/conf
rm yourdomain.se.crt
rm yourdomain.se.key
ln -sf /opt/bitnami/letsencrypt/apps/certificates/yourdomain.se.crt yourdomain.se.crt
ln -sf /opt/bitnami/letsencrypt/apps/certificates/yourdomain.se.key yourdomain.se.key
sudo /opt/bitnami/ctlscript.sh restart apache

Also, going by PageSpeed documentation, HTTPS fetching is enabled by default and no other config is necessary. If the issue persists you can try removing from the config file both the ModPagespeedDomain and ModPagespeedMapOriginDomain options?

Regards,
Francisco de Paz

Hi Fdepaz, thank you for your reply.

The folder:
/opt/bitnami/letsencrypt/apps/certificates/ does not exist on my server.
The certificates are in the " /opt/bitnami/letsencrypt/" and was generated with the bncert-tool.

ModPagespeedDomain and ModPagespeedMapOriginDomain were disabled by default, I tried to enable them temporarily to solve the problem, but had no success and disabled them again.

Correct, there is a typo in @fdepaz commands and your certificates are in the correct place.

cd /opt/bitnami/apache/conf
rm yourdomain.se.crt
rm yourdomain.se.key
ln -sf /opt/bitnami/letsencrypt/certificates/yourdomain.se.crt yourdomain.se.crt
ln -sf /opt/bitnami/letsencrypt/certificates/yourdomain.se.key yourdomain.se.key
sudo /opt/bitnami/ctlscript.sh restart apache

How are you testing that? I just accessed your site and it’s correctly using https. However, I can’t review the Pagespeed response because it’s disabled

#Include conf/pagespeed.conf
#Include conf/pagespeed_libraries.conf

Hi Jota, thank you for getting back to me.

The pagespeed is on in /opt/bitnami/apache2/conf. It might have been off when creating the support id. But it has been on since then.

Im getting alot of errors in my error log, saying:

[mod_pagespeed @548] PageSpeed Serf fetch failure rate extremely high; only 17 of 55