Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

quick and dirty build instructions #1760

Open
eilandert opened this issue Sep 25, 2022 · 20 comments
Open

quick and dirty build instructions #1760

eilandert opened this issue Sep 25, 2022 · 20 comments

Comments

@eilandert
Copy link

eilandert commented Sep 25, 2022

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

@df-a
Copy link

df-a commented Sep 28, 2022

Thank you for the effort

However, no link on tiredofit.nl works

@eilandert
Copy link
Author

eilandert commented Sep 28, 2022

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

@df-a
Copy link

df-a commented Sep 28, 2022

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
Copy link

df-a commented Sep 28, 2022

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

@eilandert
Copy link
Author

eilandert commented Sep 28, 2022

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

@Danrancan
Copy link

Danrancan commented Oct 20, 2022

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.

@eilandert
Copy link
Author

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

@khrizo
Copy link

khrizo commented Nov 15, 2022

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

@bigretromike
Copy link

@eilandert thanks, Rocky Linux 9
nginx: 1.23.2

@shanemarsh28
Copy link

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

@ronilaukkarinen
Copy link

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

@sharmashivanand
Copy link

@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.

@eilandert
Copy link
Author

eilandert commented Dec 19, 2022

@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
Copy link
Author

eilandert commented Dec 19, 2022

@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).

@ronilaukkarinen
Copy link

@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
Copy link

ronilaukkarinen commented Jan 10, 2023

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.

@eilandert
Copy link
Author

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

@ronilaukkarinen
Copy link

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

@Danrancan
Copy link

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!

@eilandert
Copy link
Author

eilandert commented Jan 13, 2023

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants