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

quick and dirty build instructions

Open eilandert opened this issue 3 years ago • 20 comments
trafficstars

On popular demand, build instructions

This should take care of both the glibc issue and the changed api in nginx 1.23.0+ This PSOL library is build from git, commit 409bd76 and is numbered 1.15.0.0-8917 (after commit 409bd76/11 apr 2020 I can't build PSOL anymore because of the move to Bazel, never got that to work)

Don't forget builddependencies like uuid-dev (apt install uuid-dev)

If you are on a newer glibc (2.33+) you need psol-jammy.tar.xz, if you are on an older glibc you can try psol-focal.tar.xz, psol-bionic.tar.xz, psol-xenial.tar.xz or even psol-trusty.tar.xz. The ubuntu name indicates on which system I compiled the library, you can use it on debian, centos or whatever distro, you are not limited to ubuntu. (but you are limited to x64)

You can use any combination of NGINX_VERSION and PSOL.

#!/bin/sh NGINX_VERSION="1.23.1" PSOL="jammy" mkdir -p /opt/build-pagespeed cd /opt/build-pagespeed wget https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz wget http://www.tiredofit.nl/psol-${PSOL}.tar.xz git clone --depth=1 https://github.com/apache/incubator-pagespeed-ngx.git tar xvf psol-${PSOL}.tar.xz mv psol incubator-pagespeed-ngx tar zxvf nginx-${NGINX_VERSION}.tar.gz cd nginx-${NGINX_VERSION} ./configure --with-compat --add-dynamic-module=../incubator-pagespeed-ngx make modules

If you do: ls objs you should see ngx_pagespeed.so How to handle the .so is left as exercise for the reader.

If there is any error or missing dependency, you should be able to figure it out from objs/autoconf.err

I have precompiled packages here: https://deb.myguard.nl/nginx-modules/ (debian and ubuntu) Launchpad (ubuntu only): https://launchpad.net/~eilander/+archive/ubuntu/nginx. Docker: https://hub.docker.com/r/eilandert/nginx-modsecurity3-pagespeed My contact information is also on those links

eilandert avatar Sep 25 '22 13:09 eilandert

Thank you for the effort

However, no link on tiredofit.nl works

df-a avatar Sep 28 '22 19:09 df-a

Thank you for the effort

However, no link on tiredofit.nl works

eilander@build:/tmp$ wget http://www.tiredofit.nl/psol-jammy.tar.xz --2022-09-28 21:24:32-- http://www.tiredofit.nl/psol-jammy.tar.xz Resolving www.tiredofit.nl (www.tiredofit.nl)... 2a01:7c8:aaaf:2af::1, 185.10.51.122 Connecting to www.tiredofit.nl (www.tiredofit.nl)|2a01:7c8:aaaf:2af::1|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 10417468 (9.9M) [application/octet-stream] Saving to: ‘psol-jammy.tar.xz’

psol-jammy.tar.xz 100%[========================================================================================>] 9.93M 44.1MB/s in 0.2s

strange, seems to work here

eilandert avatar Sep 28 '22 19:09 eilandert

Thank you, now it downloaded psol-jammy.

I assume to download focal/bionic/xenial you just have to change "jammy" to one of those keywords? If so, all other 3 are 404

Example focal:

$ wget http://www.tiredofit.nl/psol-focal.tar.xz
--2022-09-28 15:29:07--  http://www.tiredofit.nl/psol-focal.tar.xz
Resolving www.tiredofit.nl (www.tiredofit.nl)... 2a01:7c8:aaaf:2af::1, 185.10.51.122
Connecting to www.tiredofit.nl (www.tiredofit.nl)|2a01:7c8:aaaf:2af::1|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2022-09-28 15:29:07 ERROR 404: Not Found.

df-a avatar Sep 28 '22 19:09 df-a

Thank you for the effort However, no link on tiredofit.nl works

eilander@build:/tmp$ wget http://www.tiredofit.nl/psol-jammy.tar.xz --2022-09-28 21:24:32-- http://www.tiredofit.nl/psol-jammy.tar.xz Resolving www.tiredofit.nl (www.tiredofit.nl)... 2a01:7c8:aaaf:2af::1, 185.10.51.122 Connecting to www.tiredofit.nl (www.tiredofit.nl)|2a01:7c8:aaaf:2af::1|:80%7C2a01:7c8:aaaf:2af::1%7C:80)... connected. HTTP request sent, awaiting response... 200 OK Length: 10417468 (9.9M) [application/octet-stream] Saving to: ‘psol-jammy.tar.xz’

psol-jammy.tar.xz 100%[========================================================================================>] 9.93M 44.1MB/s in 0.2s

strange, seems to work here

As http yes, it does work. Only psol-jammy.tar.xz is there though

df-a avatar Sep 28 '22 19:09 df-a

The issue was, jammy is tar.xz, the others where tar.gz. I recompressed everything with .xz as it's easier to build some kind of script, updated the instructions to reflect that.

I'll still maintain the tar.gz versions for links that are out of my control

eilandert avatar Sep 28 '22 20:09 eilandert

wget http://www.tiredofit.nl/psol-${PSOL}.tar.xz

--2022-10-20 15:50:59-- http://www.tiredofit.nl/psol-$%7BPSOL%7D.tar.xz Resolving www.tiredofit.nl (www.tiredofit.nl)... 185.10.51.122 Connecting to www.tiredofit.nl (www.tiredofit.nl)|185.10.51.122|:80... connected. HTTP request sent, awaiting response... 404 Not Found 2022-10-20 15:50:59 ERROR 404: Not Found.

Danrancan avatar Oct 20 '22 20:10 Danrancan

wget http://www.tiredofit.nl/psol-${PSOL}.tar.xz

--2022-10-20 15:50:59-- http://www.tiredofit.nl/psol-$%7BPSOL%7D.tar.xz Resolving www.tiredofit.nl (www.tiredofit.nl)... 185.10.51.122 Connecting to www.tiredofit.nl (www.tiredofit.nl)|185.10.51.122|:80%7C185.10.51.122%7C:80)... connected. HTTP request sent, awaiting response... 404 Not Found 2022-10-20 15:50:59 ERROR 404: Not Found.

Are you litterally trying to get "http://www.tiredofit.nl/psol-${PSOL}.tar.xz" ? That won't work. Are you running in sh or bash? otherwise try replacing ${PSOL} by psol-focal.tar.xz

eilandert avatar Oct 20 '22 23:10 eilandert

@eilandert thanks, working Ubuntu 22.04 nginx version: nginx/1.23.2

khrizo avatar Nov 15 '22 03:11 khrizo

@eilandert thanks, Rocky Linux 9 nginx: 1.23.2

bigretromike avatar Nov 29 '22 20:11 bigretromike

You are a lifesaver! All is good for Nginx 1.23.2 & Ubuntu 22.04. Thank you very much indeed.

smdev0925 avatar Dec 13 '22 11:12 smdev0925

Thanks for confirming folks. My only worry is that psol package tiredofit.nl, we should trust @eilandert blindly with this? Tested and it works and fixes the issue #1762 as well. This most probably fixes all the issues: #1758 #1757 #1756 #1749 #1752.

Always best if there would be an official package but one can wish... this repository has been in slumber for a while now.

I just dirty-loaded the module like this in /etc/nginx/nginx.conf:

load_module /home/rolle/nginx-1.23.2/objs/ngx_pagespeed.so;

Nginx has been installed with apt from official repository.

$ nginx -V
nginx version: nginx/1.23.2
built by gcc 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
built with OpenSSL 1.1.1f  31 Mar 2020
TLS SNI support enabled
configure arguments: --with-compat --add-dynamic-module=../incubator-pagespeed-ngx --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 --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module

ronilaukkarinen avatar Dec 13 '22 18:12 ronilaukkarinen

@eilandert So you managed to build PSOL from source in the same environment / machine? Any patches required? Would be very valuable if you can also share instructions for building PSOL from ssource. Thanks so much... My nginx is up and running with pagespeed now.

sharmashivanand avatar Dec 19 '22 16:12 sharmashivanand

@eilandert So you managed to build PSOL from source in the same environment / machine? Any patches required? Would be very valuable if you can also share instructions for building PSOL from ssource. Thanks so much... My nginx is up and running with pagespeed now.

Hi @sharmashivanand

I build those psols with docker so I have clean environments, I just uploaded my scripts to https://github.com/eilandert/build_psol. If you need anything, please let me know in that repo.

eilandert avatar Dec 19 '22 18:12 eilandert

@ronilaukkarinen

Thanks for confirming folks. My only worry is that psol package tiredofit.nl, we should trust @eilandert blindly with this?

Ofcourse not, you can always build PSOL yourself, my setup is merely a proof of concept that a new glibc or nginx is not the end of PageSpeed, I wanted to give a solution to all those open questions for two simple fixes. It's a shame there seems to be no development at all since the move to the bazel buildsystem (which I never got to work myself, so I am stuck on the last working commit, 409bd76).

eilandert avatar Dec 19 '22 20:12 eilandert

@eilandert There were no build scripts so we used your prebuilt, thanks for that.

It's a shame there seems to be no development at all since the move to the bazel buildsystem (which I never got to work myself, so I am stuck on the last working commit, 409bd76).

Second to this. I'm sure many use ngx_pagespeed. I hope we'll have a maintainer in the future.

ronilaukkarinen avatar Dec 19 '22 20:12 ronilaukkarinen

Would you be willing to write a tutorial for people to build their own PSOL instead of using wget http://www.tiredofit.nl/psol-${PSOL}.tar.xz? I could then share my way of upgrading ngx-pagespeed via bash script.

ronilaukkarinen avatar Jan 10 '23 17:01 ronilaukkarinen

Would you be willing to write a tutorial for people to build their own PSOL instead of using wget http://www.tiredofit.nl/psol-${PSOL}.tar.xz? I could then share my way of upgrading ngx-pagespeed via bash script.

Hi @ronilaukkarinen , I have posted my buildprocess on https://github.com/eilandert/build_psol

eilandert avatar Jan 10 '23 18:01 eilandert

Oh, right. Sorry, missed that. Thanks @eilandert for your hard work! 👍

ronilaukkarinen avatar Jan 10 '23 18:01 ronilaukkarinen

Would you be willing to write a tutorial for people to build their own PSOL instead of using wget http://www.tiredofit.nl/psol-${PSOL}.tar.xz? I could then share my way of upgrading ngx-pagespeed via bash script.

Hi @ronilaukkarinen , I have posted my buildprocess on https://github.com/eilandert/build_psol

I'm a relatively clueless noob who has managed to build a well functioning web server on a raspberry pi. My question is, will your build scripts/ build process work for compiling ARM64 PSOL binaries? If so, where exactly do I start? thanks for your work!

Danrancan avatar Jan 11 '23 03:01 Danrancan

Would you be willing to write a tutorial for people to build their own PSOL instead of using wget http://www.tiredofit.nl/psol-${PSOL}.tar.xz? I could then share my way of upgrading ngx-pagespeed via bash script.

Hi @ronilaukkarinen , I have posted my buildprocess on https://github.com/eilandert/build_psol

I'm a relatively clueless noob who has managed to build a well functioning web server on a raspberry pi. My question is, will your build scripts/ build process work for compiling ARM64 PSOL binaries? If so, where exactly do I start? thanks for your work!

I have no experience with ARM or crosscompiling, however it should be possible. But my script fetches AMD64 dockers to compile so thats a no go. Also, I have some tweaks for compiling on newer GLIBC, I don't know if that applies for ARM too.

This git repo has done it, precompiled and with instructions to build it yourself all below the page: https://gitlab.com/gusco/ngx_pagespeed_arm . If you are going to build for yourself I think you need to do the git reset --hard thingie I have in my script.

eilandert avatar Jan 13 '23 22:01 eilandert