Articles in this section

.html files of a website show a blank page page when Apache PageSpeed module is enabled on a Plesk server

Plesk for Linux kb: technical

Applicable to:

  • Plesk for Linux

Symptoms

  • .html files, including the Default Plesk page (index.html), display a blank page instead of the content. Other static files are also not opened. .php files are opened correctly.
  • Records like the following appear in a Browser Developer Console of a web-browser:

    CONFIG_TEXT: GET https://example.com/A.style.css.pagespeed.cf.IzHunpedlN.css net::ERR_ABORTED 404
    (index):45 Uncaught ReferenceError: mod_pagespeed_masdEi5Tr is not defined

  • nginx reverse proxy is enabled on the server. Check this in Plesk at Tools & Settings > Services Management.


    Screenshot_2019-03-26_Services_-_Plesk_Onyx_17_8_11.png
     

  • Apache PageSpeed module is installed and loaded. Check this in Plesk at Tools & Settings > Apache Web Server > pagespeed.

Cause

Apache PageSpeed module prevents static files from being served correctly.

Resolution

Apply one of the following solutions:

Solution 1: Disable smart static files processing by nginx

For best experience, Apache PageSpeed recommends to have static files processed by Apache. To enable this setting, follow the steps:

 

Disabling smart static files processing via Plesk

  1. Go to Domains > example.com > Apache & nginx Settings and disable the option Smart static files processing.
  2. Click OK to apply the changes.

    Note: It is not possible to manage this option via service plan settings.

 

To disable smart static files processing by nginx for all newly created domains, apply the following steps:

  1. Connect to the server via SSH.
  2. Create the sh script with any text editor, for example:

    # vi /usr/local/psa/bin/script.sh

  3. Add the following lines in the script:

    CONFIG_TEXT: #!/bin/bash
    echo "starting" >> /tmp/event_handler.log
    plesk bin subscription --update-web-server-settings ${NEW_DOMAIN_NAME} -nginx-transparent-mode true
    echo "added ${NEW_DOMAIN_NAME}" >> /tmp/event_handler.log

  4. Make it executable:

    # chmod 755 /usr/local/psa/bin/script.sh

  5. Go to Tools & Settings > Event Manager > Add Event Handler
  6. Choose "Physical hosting created" as an event and put the following command in the "Command" field:

    # sh /usr/local/psa/bin/script.sh

  7. Click OK. From now on, all newly created domains will have this option disabled.

 

 

Disabling smart static files processing via a command-line interface

Connect to the server via SSH and disable Smart static files processing using the following command:

  • For a domain:

    # plesk bin subscription --update-web-server-settings example.net -nginx-transparent-mode true

  • For all domains:

    # for subs in `plesk bin site --list`; do echo Processing subscription... $subs; plesk bin subscription --update-web-server-settings $subs -nginx-transparent-mode true; done

Solution 2: Turn off Apache PageSpeed module

 

If Smart static files processing must remain enabled, turn off Apache PageSpeed module so that it does not interfere with static files processing:

 

Turning off Apache PageSpeed module via Plesk

  1. Go to Tools & Settings > Apache Web Server.
  2. Uncheck pagespeed (and pagespeed_ap24 if enabled) and click OK.

 

 

Turning off Apache PageSpeed module via a command-line interface

  1. Connect to the Plesk server via SSH.
  2. Disable Apache mod_pagespeed:
    • on CentOS/RHEL-based distributions

      # mv /etc/httpd/conf.d/pagespeed.conf /etc/httpd/conf.d/pagespeed.conf.bak

    • on Debian/Ubuntu-based distributions

      # a2dismod pagespeed

  3. Restart Apache web-server:
    • on CentOS/RHEL-based distributions

      # service httpd restart

    • on Debian/Ubuntu-based distributions

      # service apache2 restart

  4. Verify that the module has been disabled - there must be no output in the command below:
    • on CentOS/RHEL-based distributions

      # httpd -M | grep pagespeed

    • on Debian/Ubuntu-based distributions

      # apache2ctl -M | grep pagespeed

 

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.