#!/bin/bash

cd /root
tar -zxf openresty-{{ openresty_version }}.tar.gz
cd openresty-{{ openresty_version }}
./configure \
--prefix=/usr/local/openresty \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_stub_status_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_realip_module \
{% if pcre_path %}
--with-pcre={{ pcre_path }} \
{% else %}
--with-pcre \
{% endif %}
--with-pcre-jit \
--with-http_flv_module \
--with-file-aio \
--with-http_addition_module \
#--add-module=../ngx_cache_purge-master

make -j{{ ansible_processor_vcpus }} && make install
make clean
cd ..
