-
-
Save positiveque/f1a06b433ce3e8fcde6bf74930f53c9e to your computer and use it in GitHub Desktop.
Install PageSpeed on Ubuntu Nginx Extras
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Deps | |
| sed -i "s|# deb-src|deb-src|" /etc/apt/sources.list | |
| apt update | |
| export DEPS=" \ | |
| build-essential zlib1g-dev libpcre3-dev unzip uuid-dev \ | |
| debhelper po-debconf libexpat-dev libgd-dev libgeoip-dev libhiredis-dev \ | |
| libluajit-5.1-dev libmhash-dev libpam0g-dev libperl-dev libssl-dev libxslt1-dev quilt" | |
| apt install -y $DEPS | |
| # NXG Pagespeed | |
| ln -s /bin/bash /bin/sudo | |
| bash <(curl -f -L -sS https://ngxpagespeed.com/install) -y | |
| # Nginx | |
| mkdir ~/nginx | |
| cd ~/nginx | |
| apt source nginx-extras | |
| cd nginx-* | |
| # Build | |
| sed -i 's|extras_configure_flags := |extras_configure_flags := --add-module=${HOME}/incubator-pagespeed-ngx-latest-stable |' debian/rules | |
| dpkg-buildpackage -b | |
| # Install | |
| cd .. | |
| dpkg -i nginx-extras_*.deb | |
| # Cleanup | |
| apt remove -y $DEPS | |
| apt autoremove -y | |
| cd ~ | |
| rm incubator-* nginx -rf | |
| # Verify installation | |
| [ ! -z "`nginx -V 2>&1 | grep pagespeed`" ] && echo "Nginx with Pagespeed successfully installed!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment