Skip to content

Instantly share code, notes, and snippets.

@lanceliao
Last active October 3, 2015 06:18
Show Gist options
  • Save lanceliao/63b6d8716ead2f171f5e to your computer and use it in GitHub Desktop.
Save lanceliao/63b6d8716ead2f171f5e to your computer and use it in GitHub Desktop.
Compile and install nginx for OpenShift with memory cache, webdav and fancyindex support
#!/bin/sh
#
# Compile and install nginx for OpenShift
# with memory cache, webdav and fancyindex support
#
# This is a universal script which can run on any type of OpenShift gears
# Note:
# install dir: $OPENSHIFT_DATA_DIR
# tmp dir: $OPENSHIFT_TMP_DIR
# log dir: $OPENSHIFT_LOG_DIR
#
# Copyright (C) 2013 http://www.shuyz.com
#
# If you're not compiling nginx on OpenShift, please change these parameters
OPENSHIFT_DATA_DIR=$OPENSHIFT_DATA_DIR
OPENSHIFT_TMP_DIR=$OPENSHIFT_TMP_DIR
OPENSHIFT_LOG_DIR=$OPENSHIFT_LOG_DIR
cd ${OPENSHIFT_TMP_DIR}
wget http://nginx.org/download/nginx-1.9.5.tar.gz -O nginx.zip
wget http://robots.shuyz.com/mist/pcre-8.37.zip -O pcre.zip
wget https://github.com/openresty/memc-nginx-module/archive/master.zip -O memc-nginx-module-master.zip
wget https://github.com/openresty/srcache-nginx-module/archive/master.zip -O srcache-nginx-module-master.zip
wget https://github.com/arut/nginx-dav-ext-module/archive/master.zip -O nginx-dav-ext-module-master.zip
wget https://github.com/aperezdc/ngx-fancyindex/archive/master.zip -O ngx-fancyindex-master.zip
tar -xzvf nginx.zip
unzip memc-nginx-module-master.zip
unzip srcache-nginx-module-master.zip
unzip nginx-dav-ext-module-master.zip
unzip ngx-fancyindex-master.zip
unzip pcre.zip
cd nginx-?.?.?
# if you changed the version of pcre, remember to change the dir below
./configure --prefix=${OPENSHIFT_DATA_DIR}/nginx \
--http-client-body-temp-path=${OPENSHIFT_TMP_DIR}/client_body_temp \
--http-proxy-temp-path=${OPENSHIFT_TMP_DIR}/proxy_temp \
--http-fastcgi-temp-path=${OPENSHIFT_TMP_DIR}/fastcgi_temp \
--http-uwsgi-temp-path=${OPENSHIFT_TMP_DIR}/uwsgi_temp \
--http-scgi-temp-path=${OPENSHIFT_TMP_DIR}/scgi_temp \
--error-log-path=${OPENSHIFT_LOG_DIR}/error.log \
--http-log-path=${OPENSHIFT_LOG_DIR}/access.log \
--pid-path=${OPENSHIFT_LOG_DIR}/nginx.pid \
--lock-path=${OPENSHIFT_LOG_DIR}/nginx.lock \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_dav_module \
--with-http_gzip_static_module \
--with-ipv6 \
--with-http_stub_status_module \
--with-pcre=/tmp/pcre-8.37 \
--add-module=/tmp/memc-nginx-module-master \
--add-module=/tmp/srcache-nginx-module-master \
--add-module=/tmp/nginx-dav-ext-module-master \
--add-module=/tmp/ngx-fancyindex-master \
--with-cc-opt='-O3'
make
make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment