Skip to content

Instantly share code, notes, and snippets.

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 tvvocold/6a6074104eb6ea292856 to your computer and use it in GitHub Desktop.
Save tvvocold/6a6074104eb6ea292856 to your computer and use it in GitHub Desktop.
#!/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
#
cd ${OPENSHIFT_TMP_DIR}
wget http://nginx.org/download/nginx-1.7.0.tar.gz -O nginx.zip
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.36.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 pcre.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
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.36 \
--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