Hello, testing directadmin on debian 10 and needed to install mod_pagespeed. Didn't found any instructions specific for Directadmin as apache directory structure is not standard to debian, therefor instruction from this page https://www.modpagespeed.com/doc/download will fail.
I have got it working on my server by installing from source and documenting them here, i have only tested my install once so if anyone else does follow can you please leave note if it works or any changes required. Most of the steps are from here https://www.modpagespeed.com/doc/build_mod_pagespeed_from_source updated for directadmin
Some of the libraries download and compile can take some time so please keep this mind
System: Debian 10
Directadmin latest
Apache 2.4.46
Webserver : nginx_apache ( if you only have apache instructions should work as mod is installed as apache module)
Prerequisites
Install the Chromium Depot Tools
Check out mod_pagespeed and dependencies
Build & Run Tests
Compile
Install
root@staging: /usr/sbin/apxs -c -i mod_deflate.c
## this will generate mod_deflate.so and install in correct directory
root@staging: ./install_apxs.sh
## this will require user input, i went with default as they seemed correct paths
DO NOT RESTART APACHE
First we have to remove lines added to httpd.conf file because they will be overwritten by directadmin
Move config files to apache extra folder
Edit pagespeed.conf
And include pagespeed.conf and pagespeed_libraries.conf to be loaded, just edit /etc/httpd/conf/extra/httpd-includes.conf, and add these lines:
Restart Apache Now
If you enabled statistics or admin url will be sub.server.tld/pagespeed_global_admin ( admin global will show all, you can switch it with any SetHandler directive enabled in configuration about.
I have got it working on my server by installing from source and documenting them here, i have only tested my install once so if anyone else does follow can you please leave note if it works or any changes required. Most of the steps are from here https://www.modpagespeed.com/doc/build_mod_pagespeed_from_source updated for directadmin
Some of the libraries download and compile can take some time so please keep this mind
System: Debian 10
Directadmin latest
Apache 2.4.46
Webserver : nginx_apache ( if you only have apache instructions should work as mod is installed as apache module)
Prerequisites
Code:
root@staging: sudo apt-get update
root@staging: sudo apt-get install sudo subversion gperf make devscripts fakeroot git zlib1g-dev uuid-dev
Install the Chromium Depot Tools
Code:
root@staging: mkdir -p ~/bin
root@staging: cd ~/bin
root@staging: git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git --depth=1
## add depot_tools to path
root@staging: nano ~/.bashrc
## Add at the bottom of file
export PATH=$PATH:~/bin/depot_tools
Save and exit, reload bash
root@staging: source ~/.bashrc
Check out mod_pagespeed and dependencies
Code:
root@staging:git clone -b latest-stable --recursive https://github.com/apache/incubator-pagespeed-mod.git --depth=1
root@staging:cd incubator-pagespeed-mod
root@staging:python build/gyp_chromium --depth=.
root@staging:make BUILDTYPE=Release mod_pagespeed_test pagespeed_automatic_test
Build & Run Tests
Code:
root@staging: ./out/Release/mod_pagespeed_test
[QUOTE]
[----------] Global test environment tear-down
[==========] 172 tests from 19 test cases ran. (16812 ms total)
[ PASSED ] 171 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] SerfUrlAsyncFetcherTest.FetchUsingDifferentRequestMethod
1 FAILED TEST
YOU HAVE 1 DISABLED TEST
[/QUOTE]
Got one test failed, ignore it for now
root@staging: ./out/Release/pagespeed_automatic_test
Compile
Code:
root@staging: make BUILDTYPE=Release
Install
root@staging: cd third_party/httpd24/src/modules/filtersinstall requires mod_deflate.so which is not available as its compiled with apache, so we have to generate this module file
root@staging: /usr/sbin/apxs -c -i mod_deflate.c
## this will generate mod_deflate.so and install in correct directory
root@staging: cd ~/bin/incubator-pagespeed-mod/install/Libraries have been installed in:
/usr/lib/apache
root@staging: ./install_apxs.sh
## this will require user input, i went with default as they seemed correct paths
Using /usr/sbin/apxs to determine installation location.
mod_pagespeed needs to cache optimized resources on the file system.
The default location for this cache is '/var/cache/mod_pagespeed'.
Would you like to specify a different location? (y/N) N
Preparing to install to the following locations:
/usr/lib/apache/mod_pagespeed.so (root:root)
/usr/lib/apache/mod_pagespeed_ap24.so (root:root)
/usr/local/bin/pagespeed_js_minify (root:root)
/etc/httpd/conf/pagespeed.conf (root:root)
/etc/httpd/conf/pagespeed_libraries.conf (root:root)
/var/cache/mod_pagespeed (apache:apache)
Continue? (y/N) y
Adding a load line for mod_pagespeed to /etc/httpd/conf/httpd.conf.
Adding a load line for pagespeed_libraries to /etc/httpd/conf/httpd.conf.
Installation succeeded.
Restart apache to enable mod_pagespeed.
DO NOT RESTART APACHE
First we have to remove lines added to httpd.conf file because they will be overwritten by directadmin
Move config files to apache extra folder
Code:
root@staging: nano /etc/httpd/conf/httpd.conf
## remove last 2 lines containing pagespeed and pagespeed_libraries directives, save and exit
## move files
root@staging: mv -f /root/mod_pagespeed/out/usr/bin/pagespeed_js_minify /usr/bin/pagespeed_js_minify
root@staging: mv -f /etc/httpd/conf/pagespeed.conf /etc/httpd/conf/extra/pagespeed.conf
root@staging: mv -f /etc/httpd/conf/pagespeed_libraries.conf /etc/httpd/conf/extra/pagespeed_libraries.conf
Edit pagespeed.conf
Code:
root@staging: nano /etc/httpd/conf/extra/pagespeed.conf
## Required Change
ModPagespeedSslCertDirectory ""
TO
ModPagespeedSslCertDirectory "/etc/ssl/certs"
## OPTIONAL: Enable Filters, i did enabled CoreFilters you can read up on pagespeed website for more information
# ModPagespeedRewriteLevel PassThrough
changed to
ModPagespeedRewriteLevel CoreFilters
## OPTIONAL : Enable admin to view pagespeed statistics, please read upon this directive and how to secure it. As of my understanding it can be only bound to ip address, there maybe other ways of securing it if you find one please share
## Search
# ModPagespeedStatistics off
Change
ModPagespeedStatistics on
<Location /mod_pagespeed_statistics>
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>
Require local
require ip your_ip_address
SetHandler mod_pagespeed_statistics
</Location>
<Location /mod_pagespeed_message>
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>
Require local
require ip your_ip_address
SetHandler mod_pagespeed_message
</Location>
## OPTIONAL : Enable administration
[QUOTE]
<Location /pagespeed_admin>
<IfVersion < 2.4>
Order allow,deny
Allow from localhost
Allow from 127.0.0.1
</IfVersion>
<IfVersion >= 2.4>
Require local
require ip your_ip_address --> add your ip
# see https://httpd.apache.org/docs/current/en/mod/mod_authz_host.html - Require all granted,
# Require ip, Require host or Require forward-dns,
# if access must be granted to other than local.
</IfVersion>
SetHandler pagespeed_admin
</Location>
<Location /pagespeed_global_admin>
<IfVersion < 2.4>
Order allow,deny
Allow from localhost
Allow from 127.0.0.1
</IfVersion>
<IfVersion >= 2.4>
Require local
require ip your_ip_address --> add your ip
</IfVersion>
SetHandler pagespeed_global_admin
</Location>
[/QUOTE]
Code:
Include /etc/httpd/conf/extra/pagespeed.conf
Include /etc/httpd/conf/extra/pagespeed_libraries.conf
Restart Apache Now
Code:
systemctl restart httpd
### if for some reason apache fails to start just edit /etc/httpd/conf/extra/httpd-includes.conf and remove the include directives added above, restart apache
If you enabled statistics or admin url will be sub.server.tld/pagespeed_global_admin ( admin global will show all, you can switch it with any SetHandler directive enabled in configuration about.