Skip to content

Instantly share code, notes, and snippets.

@taf2
Created July 17, 2019 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taf2/bb223bb413d5e4ae450b4d0feab262fd to your computer and use it in GitHub Desktop.
Save taf2/bb223bb413d5e4ae450b4d0feab262fd to your computer and use it in GitHub Desktop.
build openresty with ngx_cache_purge
# Installation of Openresty (Nginx + modules)
# Prepare with install some required packages
sudo apt-get install gcc make perl libpcre3-dev libssl-dev libreadline-dev libncurses5-dev libpcre3-dev libssl-dev libxslt-dev libgeoip-dev
# Add the Nginx user that will be used to run the daemon
sudo adduser --system --no-create-home --disabled-login --disabled-password --group nginx
# Go into /tmp folder for download and compiling Nginx
mkdir -p /tmp/nginx && cd /tmp/nginx
# Download the latest Openresty + ngx_cache_purge module
wget http://openresty.org/download/ngx_openresty-1.5.8.1.tar.gz
wget http://labs.frickle.com/files/ngx_cache_purge-2.1.tar.gz
# Unpack the downloaded files
tar -xzvf ngx_openresty-1.5.8.1.tar.gz
tar -xzvf ngx_cache_purge-2.1.tar.gz
# Move the modules into openresty bundle folder
mv ngx_cache_purge-2.1 ngx_openresty-1.5.8.1/bundle/
# Configure Openresty install
sudo ./configure \
--prefix=/usr/share \
--sbin-path=/usr/sbin \
--user=nginx \
--group=nginx \
--conf-path=/etc/nginx/nginx.conf \
--http-log-path=/var/log/nginx/access.log \
--error-log-path=/var/log/nginx/error.log \
--http-client-body-temp-path=/usr/share/nginx/body \
--http-fastcgi-temp-path=/usr/share/nginx/fastcgi \
--http-proxy-temp-path=/usr/share/nginx/proxy \
--http-scgi-temp-path=/usr/share/nginx/scgi \
--http-uwsgi-temp-path=/usr/share/nginx/uwsgi \
--lock-path=/var/run/nginx.lock \
--pid-path=/var/run/nginx.pid \
--with-pcre-jit \
--with-debug \
--with-http_addition_module \
--with-http_dav_module \
--with-http_geoip_module \
--with-http_gzip_static_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-http_sub_module \
--with-http_xslt_module \
--with-ipv6 \
--with-mail \
--with-mail_ssl_module \
--with-luajit \
--add-module=bundle/ngx_cache_purge-2.1
# Install
sudo make
sudo make install
# Get a init script for your Nginx build here.
# Modify it according to your build settings.
https://github.com/Fleshgrinder/nginx-sysvinit-script
# Place the init-script in /etc/init.d/nginx.
# And run nginx with.
/etc/init.d/nginx start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment