ngx_pagespeed install with directadmin

eka

Verified User
Hello i miss some information how to :)

I installed page speed by using this tutorial
https://developers.google.com/speed/pagespeed/module/build_ngx_pagespeed_from_source

Later by using Directadmin tutorial added custom module
http://help.directadmin.com/item.php?id=545

--add-module=/root/ngx_pagespeed-release-1.9.32.3-beta

[root@server ~]# nginx -V
nginx version: nginx/1.6.2
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
TLS SNI support enabled
configure arguments: --add-module=/root/ngx_pagespeed-release-1.9.32.3-beta --prefix=/usr/local/nginx --sbin-path=/usr/local/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/run/nginx.pid --with-ipv6 --lock-path=/run/lock/subsys/nginx --with-http_ssl_module --with-http_stub_status_module --with-http_gzip_static_module --with-http_realip_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --user=nginx --group=nginx --with-cc-opt=''-D FD_SETSIZE=32768''

"Download and build nginx with support for pagespeed:"
i downloaded it to
/root/nginx-1.6.3

how can i make directadmin to use this build?
 

eka

Verified User
Come on guys.
At least small explanation that i could understand how is everything working.
Guide me in words or show me an article that related with this would be nice.
 

eka

Verified User
#/usr/local/nginx/sbin/nginx -V

Returns
nginx version: nginx/1.6.3
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
configure arguments: --add-module=/root/ngx_pagespeed-release-1.9.32.3-beta

#nginx -v
nginx version: nginx/1.6.2

So i am have 2 versions of nginx.
How can i make to use
/usr/local/nginx/sbin/nginx
 

smtalk

Verified User
Staff member
/usr/local/nginx/sbin/nginx should not be used on DirectAdmin servers. "Download and build nginx with support for pagespeed:" is not a sentence from DA knowledgebase. You should always use CustomBuild (./build nginx) for that.
 

eka

Verified User
Thank YOU zEitEr!!!!!

Your message just inspired me to try it again :)
Just deleted everything... And started from 0.

And I made it finally. After I send my page to gtmetrix there was no message avoid css imports....
I dont know what i did wrong before... But after a clean install it is working now...

You are my hero zEitEr thanks:)

1st download and extract ngx_pagespeed

# cd
# NPS_VERSION=1.9.32.3
# wget https://github.com/pagespeed/ngx_pagespeed/archive/release-${NPS_VERSION}-beta.zip
# unzip release-${NPS_VERSION}-beta.zip
# cd ngx_pagespeed-release-${NPS_VERSION}-beta/
# wget https://dl.google.com/dl/page-speed/psol/${NPS_VERSION}.tar.gz
# tar -xzvf ${NPS_VERSION}.tar.gz

2nd make a copy of configure.nginx into /usr/local/directadmin/custombuild/custom/nginx

# cd /usr/local/directadmin/custombuild
# mkdir -p custom/nginx
# cp -fp configure/nginx/configure.nginx custom/nginx/configure.nginx

3rd adding ngx_pagespeed module to /usr/local/directadmin/custombuild/custom/nginx/configure.nginx

# nano /usr/local/directadmin/custombuild/custom/nginx/configure.nginx

#!/bin/sh
./configure \
"--add-module=/root/ngx_pagespeed-release-1.9.32.3-beta" \
"--user=nginx" \
"--group=nginx" \
"--prefix=/usr" \
"--sbin-path=/usr/sbin" \
"--conf-path=/etc/nginx/nginx.conf" \
"--pid-path=/var/run/nginx.pid" \
"--http-log-path=/var/log/nginx/access_log" \
"--error-log-path=/var/log/nginx/error_log" \
"--with-ipv6" \
"--without-mail_imap_module" \
"--without-mail_smtp_module" \
"--with-http_ssl_module" \
"--with-http_realip_module" \
"--with-http_stub_status_module" \
"--with-http_gzip_static_module" \

# ./build used_configs
# ./build nginx
# nginx -V
nginx version: nginx/1.6.2
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
TLS SNI support enabled
configure arguments: --add-module=/root/ngx_pagespeed-release-1.9.32.3-beta --user=nginx --group=nginx --prefix=/usr --sbin-path=/usr/sbin --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --http-log-path=/var/log/nginx/access_log --error-log-path=/var/log/nginx/error_log --with-ipv6 --without-mail_imap_module --without-mail_smtp_module --with-http_ssl_module --with-http_realip_module --with-http_stub_status_module --with-http_gzip_static_module --with-http_dav_module --with-cc-opt=''-D FD_SETSIZE=32768''

Module is added.

Directadmin>Admin Level>Custom HTTPD Configurations>

pagespeed on;
pagespeed FileCachePath /var/ngx_pagespeed_cache;
pagespeed EnableFilters flatten_css_imports;

It is working... finally...
 

trix.hosting

Verified User
YES! its working for nginx_apache, You have to install for nginx as the official page says.

Great, i have 2 seconds page load now, before was aprox 10 seconds
 

Mattpl

Verified User
Hi, I using Nginx_apache and have install mod_pagespeed as the official page says and copy to ./custom/nginx conf file for nginx. Insert into it --add-module=/root/ngx_pagespeed-release next in cmd
./build used_configs
./build nginx

but Nginx build still without modpagespeed and without error's
root@serwer:/usr/local/directadmin/custombuild# nginx -V
nginx version: nginx/1.17.1
built by gcc 4.9.2 (Debian 4.9.2-10+deb8u2)
built with OpenSSL 1.0.2p 14 Aug 2018
TLS SNI support enabled
configure arguments: --user=nginx --group=nginx --prefix=/usr --sbin-path=/usr/sbin --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --http-log-path=/var/log/nginx/access_log --error-log-path=/var/log/nginx/error_log --without-mail_imap_module --without-mail_smtp_module --with-http_ssl_module --with-http_realip_module --with-http_stub_status_module --with-http_gzip_static_module --with-http_dav_module --with-http_v2_module --with-cc-opt=''-D FD_SETSIZE=32768'' --with-openssl=/usr/local/directadmin/custombuild/custom/nginx_reverse/openssl-1.0.2p --with-http_v2_module
 

smtalk

Verified User
Staff member
Hi, I using Nginx_apache and have install mod_pagespeed as the official page says and copy to ./custom/nginx conf file for nginx. Insert into it --add-module=/root/ngx_pagespeed-release next in cmd
./build used_configs
./build nginx

but Nginx build still without modpagespeed and without error's
it is custom/nginx_reverse for nginx as a reverse proxy of apache :)
 

Mattpl

Verified User
now I'm trying to fix error
build_from_source=false
checking for psol ... not found
./configure: error: module ngx_pagespeed requires the pagespeed optimization library.
Look in /usr/local/directadmin/custombuild/nginx-1.17.1/objs/autoconf.err for more details.

*** There was an error while trying to configure Nginx. Check the custom/nginx_reverse/configure.nginx file
PSOL is downloaded to folder with mod
 

Mattpl

Verified User
alright, now is ok. Build nginx with mod_pagespeed run without erros.
nginx -V show mod, but how Can i chceck if is runing?
curl -Is https://urll/ | grep X-Mod-Pagespeed

Also trying to add into custom httpd
pagespeed on;
pagespeed FileCachePath /var/ngx_pagespeed_cache;
pagespeed EnableFilters flatten_css_imports;
have error
AH00526: Syntax error on line 45 of /usr/local/directadmin/data/users/jestpraca/httpd.conf:
Invalid command 'pagespeed', perhaps misspelled or defined by a module not included in the server configuration
 
Last edited:
Top