• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

Input How to compile NGINX with additional modules ( pagespeed / cache_purge / headers-more / and others )

Hi Rar9,

it is essential, that you provide informations about your operating system.
Further more, you really should consider to post previous errrors and how you solved them.

Makefile:794: recipe for target 'pure_site_install' failed
make[2]: *** [pure_site_install] Error 17
make[2]: Leaving directory '/root/addons/nginx/nginx-1.13.0/objs/src/http/modules/perl' objs/Makefile:2290: recipe for target 'install_perl_modules' failed
make[1]: *** [install_perl_modules] Error 2
make[1]: Leaving directory '/root/addons/nginx/nginx-1.13.0' Makefile:11: recipe for target 'install' failed
make: *** [install] Error 2
... indicates a perl - issue, so I "guess", that your server packages for perl are not up-to-date, installed at an optional install path without adjusting your bash, or has missing modules... or the path is completely missing in your bash. ;)
 
Between steps 2 and 3 there's a big mistake in the file naming. Every file name in step 3 and then possibly step 4 need fixing.

The file names that actually get downloaded in step 2 are just numbers and don't contain the file name.


Actual file names that you end up with:

v1.12.34.2-beta.tar.gz
2.3.tar.gz
1.10.tar.gz
0.2rc3.tar.gz
v0.32.tar.gz

When you unpack them, the file names return to normal, but the following commands were written to target the full names. For anyone who's interested as I can see several instances it would have made it easier for people is a tool I came across called WinSCP allows you to run SSH with a visual window like an FTP, someone like me, I really need visual guides to start making sense of things, the moment I could see the folders and how they all related to each other like a normal home computer OS the whole thing has been much easier to pick up and start to understand the rules, very worth getting if you're not an expert on linux unix commands yet.

WinSCP :: Official Site :: Download
 
Between steps 2 and 3 there's a big mistake in the file naming.
I'm sorry to point you to my RENAMING procedure in STEP 3 ( where I just corrected the new "pagespeed" - module name, to fit the the tutorial ):

...
mv v1.12.34.2-beta.tar.gz ngx_pagespeed-v1.12.34.2-beta.tar.gz
tar -xvf ngx_pagespeed-v1.12.34.2-beta.tar.gz
...

...
mv 2.3.tar.gz ngx_cache_purge-2.3.tar.gz
tar -xvf ngx_cache_purge-2.3.tar.gz
...

...
mv 1.10.tar.gz ngx_slowfs_cache-1.10.tar.gz
tar -xvf ngx_slowfs_cache-1.10.tar.gz
...

...
mv 0.2rc3.tar.gz ngx_coolkit-0.2rc3.tar.gz
tar -xvf ngx_coolkit-0.2rc3.tar.gz
...

...
mv v0.32.tar.gz ngx_headers-more-v0.32.tar.gz
tar -xvf ngx_headers-more-v0.32.tar.gz
mv headers-more-nginx-module-0.32 ngx_headers-more-0.32
 
Hi

I just checked my nginx -v to see if i have the latest nginx-1.13.2 on server or not as I could not remember....

and get :

nginx: error while loading shared libraries: libssl.so.1.0.2: cannot open shared object file: No such file or directory

but systemctl status nginx.service

● nginx.service - Startup script for nginx service
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2017-06-30 09:11:33 CEST; 6 days ago
Main PID: 2925 (nginx)
Tasks: 42
Memory: 590.5M
CPU: 2h 4min 10.881s
CGroup: /system.slice/nginx.service
├─ 2925 nginx: master process /usr/sbin/ngin
├─12617 Passenger watchdog
├─12620 Passenger core
├─12629 Passenger ust-router
└─12671 nginx: worker proces

How do I get this fixed?
 
tar -xvf nginx-1.13.2.tar.gz cd /root/addons/nginx/nginx-1.13.2 mv v1.12.34.2-beta.tar.gz ngx_pagespeed-v1.12.34.2-beta.tar.gz tar -xvf ngx_pagespeed-v1.12.34.2-beta.tar.gz cd ngx_pagespeed-1.12.34.2-beta wget https://dl.google.com/dl/page-speed/psol/1.12.34.2-x64.tar.gz tar -xzvf 1.12.34.2-x64.tar.gz

From my experience of compiling ngx_pagespeed module, I remember that serious problems caused the search for a suitable psol version URL for your version of nginx and ngx_pagespeed. I found the solution:

- go to ngx_pagespeed directory
- run following commands:

[root@a93 ngx_pagespeed]# psol_url=$(scripts/format_binary_url.sh PSOL_BINARY_URL)
[root@a93 ngx_pagespeed]# echo $psol_url
https://dl.google.com/dl/page-speed/psol/1.12.34.2-x64.tar.gz
 
Thanks UFHH01 for the great manual! Greetings to hamburg from the next big city at A7 in the south :) Hope you're all well after G20 trouble?
The tutorial has been updated to the most recent nginx versions.
Thanks again! I've done the compile now successful on my Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2 (2017-04-30) x86_64 GNU/Linux.

However, there have been some news / pitfalls:

1) I had to install passenger, passenger-dev and libgeoip-dev because I got an error (ngx_http_passenger_module not found):

Code:
apt-get install passenger passenger-dev libgeoip-dev

Maybe you can add it?

2) The version of ngx_pagespeed is stable now: v1.12.34.2-stable. Since this stable and dev release they seem to provide a link without a version number named latest-stable and latest dev respectively, see Releases · pagespeed/ngx_pagespeed · GitHub, maybe it's better to use them?
Code:
https://github.com/pagespeed/ngx_pagespeed/archive/latest-stable.tar.gz
mv ../latest-stable.tar.gz ngx_pagespeed_latest_stable.tar.gz

mkdir -p /usr/share/nginx/modules/ngx_pagespeed-latest-stable
rsync -r /root/addons/nginx/nginx-1.13.2/ngx_pagespeed-latest-stable/* /usr/share/nginx/modules/ngx_pagespeed-latest-stable

3) In the third step we are in directory /root/addons/nginx/nginx-1.13.2 but in the last step of 2 we wgetted everything to /root/addons/nginx so our mv commands have to be for example
Code:
mv ../v1.12.34.2-beta.tar.gz ngx_pagespeed-v1.12.34.2-beta.tar.gz
instead of
Code:
mv v1.12.34.2-beta.tar.gz ngx_pagespeed-v1.12.34.2-beta.tar.gz
- although no problem for experts it maybe "fixed"

4) The rsync command in step 4 contains the wrong version number:
/root/addons/nginx/nginx-1.11.13 instead of
/root/addons/nginx/nginx-1.13.2

5) The ./configure has a missing \ in the line ending with ngx_pagespeed-1.12.34.2-beta. Again, no problem for experts :) The configure with ngx_pagespeed-latest-stable:
Code:
./configure --prefix=/etc/nginx \
    --sbin-path=/usr/sbin/nginx \
    --conf-path=/etc/nginx/nginx.conf \
    --error-log-path=/var/log/nginx/error.log \
    --http-log-path=/var/log/nginx/access.log \
    --lock-path=/var/lock/nginx.lock \
    --pid-path=/var/run/nginx.pid \
    --http-client-body-temp-path=/var/lib/nginx/body \
    --http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
    --http-proxy-temp-path=/var/lib/nginx/proxy \
    --http-scgi-temp-path=/var/lib/nginx/scgi \
    --http-uwsgi-temp-path=/var/lib/nginx/uwsgi \
    --user=nginx \
    --group=nginx \
    --with-debug \
    --with-file-aio \
    --with-google_perftools_module \
    --with-ipv6 \
    --with-mail \
    --with-mail_ssl_module \
    --with-threads \
    --with-select_module \
    --with-stream \
    --with-stream_ssl_module \
    --with-http_addition_module \
    --with-http_auth_request_module \
    --with-http_dav_module \
    --with-http_flv_module \
    --with-http_geoip_module \
    --with-http_gunzip_module \
    --with-http_gzip_static_module \
    --with-http_image_filter_module \
    --with-http_mp4_module \
    --with-http_perl_module \
    --with-http_random_index_module \
    --with-http_realip_module \
    --with-http_secure_link_module \
    --with-http_stub_status_module \
    --with-http_sub_module \
    --with-http_ssl_module \
    --with-http_v2_module \
    --with-http_xslt_module \
    --with-poll_module \
    --add-module=/usr/share/passenger/ngx_http_passenger_module \
    --add-module=/usr/share/nginx/modules/ngx_pagespeed-latest-stable \
    --add-module=/usr/share/nginx/modules/ngx_cache_purge-2.3 \
    --add-module=/usr/share/nginx/modules/ngx_slowfs_cache-1.10 \
    --add-module=/usr/share/nginx/modules/ngx_coolkit-0.2rc3 \
    --add-module=/usr/share/nginx/modules/ngx_headers-more-0.32

6) Specific for my server: nginx -t throw an error:
Code:
root@server02 ~/addons/nginx/nginx-1.13.2 # nginx -t
nginx: [emerg] dlopen() "/etc/nginx/nginx/modules/ngx_http_passenger_module.so" failed (/etc/nginx/nginx/modules/ngx_http_passenger_module.so: cannot open shared object file: No such file or directory) in /etc/nginx/modules.conf.d/phusion-passenger.conf:1
I had to remove /etc/nginx/modules.conf.d/phusion-passenger.conf because it contained the wrong path to the module and the module was loaded in another conf file.

Thanks again!

Edit: Added 4
 
1) I had to install passenger, passenger-dev and libgeoip-dev because I got an error (ngx_http_passenger_module not found):
As I experienced in the past, that MOST Plesk - Users have the additional "passenger" and the GeoIP - module installed ( because they already used it with apache! ), I don't see any need to pack more packages into the basic - installation routine. Pls. just consider to remove the depending configuration ( done with
Code:
./configure --prefix=/etc/nginx \
    --sbin-path=/usr/sbin/nginx \
    --conf-path=/etc/nginx/nginx.conf \
    --error-log-path=/var/log/nginx/error.log \
    --http-log-path=/var/log/nginx/access.log \
    --lock-path=/var/lock/nginx.lock \
    --pid-path=/var/run/nginx.pid \
    --http-client-body-temp-path=/var/lib/nginx/body \
    --http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
    --http-proxy-temp-path=/var/lib/nginx/proxy \
    --http-scgi-temp-path=/var/lib/nginx/scgi \
    --http-uwsgi-temp-path=/var/lib/nginx/uwsgi \
    --user=nginx \
    --group=nginx \
    --with-debug \
    --with-file-aio \
    --with-google_perftools_module \
    --with-ipv6 \
    --with-mail \
    --with-mail_ssl_module \
    --with-threads \
    --with-select_module \
    --with-stream \
    --with-stream_ssl_module \
    --with-http_addition_module \
    --with-http_auth_request_module \
    --with-http_dav_module \
    --with-http_flv_module \
    --with-http_geoip_module \
    --with-http_gunzip_module \
    --with-http_gzip_static_module \
    --with-http_image_filter_module \
    --with-http_mp4_module \
    --with-http_perl_module \
    --with-http_random_index_module \
    --with-http_realip_module \
    --with-http_secure_link_module \
    --with-http_stub_status_module \
    --with-http_sub_module \
    --with-http_ssl_module \
    --with-http_v2_module \
    --with-http_xslt_module \
    --with-poll_module \
    --add-module=/usr/share/passenger/ngx_http_passenger_module \
    --add-module=/usr/share/nginx/modules/ngx_pagespeed-1.12.34.2-beta
    --add-module=/usr/share/nginx/modules/ngx_cache_purge-2.3 \
    --add-module=/usr/share/nginx/modules/ngx_slowfs_cache-1.10 \
    --add-module=/usr/share/nginx/modules/ngx_coolkit-0.2rc3 \
    --add-module=/usr/share/nginx/modules/ngx_headers-more-0.32 \
... and remove the depending ( integrated ) configuration, which you either don't consider as to be necessary, or didn't already installed on your server. ;)

maybe it's better to use them?
Pls. feel free to use the desired version of YOUR choice! I will certainly update this thread frequently ( and as well with URL - changes and different versions ), but not at any time, when a version changes - this would require a daily check for each of the named packages at this tutorial, which I don't want to do. Sorry! :(

But ( !!! ) pls. don't hesitate to provide a new package - name and the corresponding URL at any time to this thread, I'm sure the Plesk Community Users will be happy about your informations! ;)

3) In the third step we are in directory /root/addons/nginx/nginx-1.13.2 but in the last step of 2 we wgetted everything to /root/addons/nginx
Sorry, I don't agree here, as you can certainly see:
tar -xvf nginx-1.13.2.tar.gz
cd /root/addons/nginx/nginx-1.13.2
As we want the next packages downloaded into "/root/addons/nginx/nginx-1.13.2" ( even for the reason, that ALL packages are insider the folder from where we are going to compile nginx! ), there is no issue/problem here and I consider my tutorial as "correctly provided".

mv v1.12.34.2-beta.tar.gz ngx_pagespeed-v1.12.34.2-beta.tar.gz
This command should be considered to be a ":p:D:p", as it isn't really necessary at all. Due to the fact, that all other packages are named with "ngx_" as prefix, I decided to use this command. ;) Pls. feel free to name the packages how ever you want them to be named! :p

The ./configure has a missing \ in the line ending with ngx_pagespeed-1.12.34.2-beta
Actually, this is no error/issue, as the slash at the end of the previous lines are just used, because I wanted to display EACH ( possible ) configuration option in one line and didn't want a very long "one-line command" for the whole command. If I would use a "last" slash at the end, linux expects ANOTHER, ADDITIONAL option string, which is just not there. ;)

I had to remove /etc/nginx/modules.conf.d/phusion-passenger.conf because it contained the wrong path to the module and the module was loaded in another conf file.
As I previously mentioned, most Plesk - Users had already "passenger" installed... in your case, it was the Plesk "passenger" version, which has a different installation path. ;)
 
Sorry, I don't agree here, as you can certainly see:

As we want the next packages downloaded into "/root/addons/nginx/nginx-1.13.2" ( even for the reason, that ALL packages are insider the folder from where we are going to compile nginx! ), there is no issue/problem here and I consider my tutorial as "correctly provided".
Sorry, I don't agree with you here. The wget of the addons is to /root/addons/nginx in my opinion. I attached an image, maybe it can help to clarify what I mean.Schnappschuss_071017_110854_PM.jpg
 
ups... yes... I somehow changed the CODE - boxes... ( must had happened at the last edit... I will correct it now )
 
Thanks for this contribution.

However, I just realized my ssl enabled sites' static files are not being served via nginx/http2 nor is ALPN supported on Centos 7 due to openssl 1.0.1e.. I would suggest adding:

Code:
# wget https://www.openssl.org/source/openssl-1.1.0f.tar.gz /usr/local/src
# tar xzvf /usr/local/src/openssl-1.1.0f.tar.gz -C /usr/local/src

Add the following parameter to ./configure towards the end and then execute make/make install
Code:
--with-openssl=/usr/local/src/openssl-1.1.0f

By carrying out the above, nginx is built with the latest available openssl (or libressl) releases without altering the default OS/system's openssl and with http2/ALPN support.

Cheers
 
Hi

I am not able add google page speed module to my existing Plesk onyx with nginx.

Google page module is very Important but still even AFTER MANY YEARS plesk was not able to add this module.
 
Hi Haseeb,

could you explain a bit more in detail, WHERE you are stuck with the tutorial to compile PageSpeed into nginx?
 
Hi UFHH01

First of all thank you very much for the reply and the time you spent here much appreciated. I followed your instruction and my website stopped working. I am not expert, that could be the problem. Need to give you ssh or can you make a video.

Kind regards
Hasib.
 
Hi

I am not able add google page speed module to my existing Plesk onyx with nginx.

Google page module is very Important but still even AFTER MANY YEARS plesk was not able to add this module.
I totally agree with Haseeb
 
Back
Top