incubator-pagespeed-cpanel icon indicating copy to clipboard operation
incubator-pagespeed-cpanel copied to clipboard

Easyapache overwrites pagespeed.conf

Open stigoleg opened this issue 10 years ago • 1 comments

Hi, Thanks for this great plugin. Easyapache will overwrite pagespeed.conf, deleting all custom rules. Is there a simple fix for this?

stigoleg avatar Feb 26 '15 08:02 stigoleg

Before you run /scripts/easyapache in the future, create these files:

vi /scripts/preeasyapache

Place the following content into the file:

#!/bin/bash
if [ -e "/usr/local/apache/conf/pagespeed.conf" ]; then
   cp -prf /usr/local/apache/conf/pagespeed.conf /root/
fi

Next, create this file

vi /scripts/posteasyapache

Place the following content into the file:

if [ -e "/usr/local/apache/conf/pagespeed.conf" ]; then
   mv /usr/local/apache/conf/pagespeed.conf /usr/local/apache/conf/pagespeed.conf _easy
   cp -prf /root/pagespeed.conf /usr/local/apache/conf/pagespeed.conf
   /etc/init.d/httpd restart
fi

The first script copies the existing pagespeed config file to /root/ at the beginning of the Apache build. The second script copies pagespeed.conf back into /usr/local/apache/conf/ folder, and restarts Apache at the end of the build.

After saving these files, ensure they can execute:

chmod +x /scripts/preeasyapache
chmod +x /scripts/posteasyapache

cPanel EasyApache Hooks: https://documentation.cpanel.net/display/EA/Script+Hooks

Prajithp avatar Feb 26 '15 08:02 Prajithp