Skip to content

Instantly share code, notes, and snippets.

@mhuckaby
Created August 28, 2013 15:28
Show Gist options
  • Save mhuckaby/6367350 to your computer and use it in GitHub Desktop.
Save mhuckaby/6367350 to your computer and use it in GitHub Desktop.
# This script compiles nginx + echo module on Ubuntu
# Tested on Ubuntu 10.04 LTS (Lucid Lynx), 32 bit
# Resources:
# - http://extralogical.net/articles/howto-compile-nginx-passenger.html
# - http://wiki.nginx.org/InstallOptions
# - http://wiki.nginx.org/CommandLine
# - http://superuser.com/questions/336275/find-out-if-user-name-exists - check if the user exists
# Tips:
# - See the actual configuration with: sudo nginx -V
# Create the temp structure
mkdir -p /tmp/nginx-installation; cd /tmp/nginx-installation
# Download the latest stable naginx
wget http://nginx.org/download/nginx-1.2.2.tar.gz # Get the actual version links from: http://nginx.org/en/download.html
tar -xzvf nginx-1.2.2.tar.gz && rm -f ./nginx-1.2.2.tar.gz
# Download the HttpEchoModule
wget https://github.com/agentzh/echo-nginx-module/tarball/v0.40rc1 # Check the latest stable version on https://github.com/agentzh/echo-nginx-module/tags
tar -xzvf v0.40rc1 && rm -f ./v0.40rc1
# Download PCRE
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.20.tar.gz
tar -xzvf pcre-8.20.tar.gz && rm -f ./pcre-8.20.tar.gz
# Debian Install make
sudo apt-get install make
# Install nginx
cd nginx-1.2.2
# check nginx compilation flags
# $ sudo nginx -V
./configure \
--prefix=/usr/local/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--user=nginx \
--group=nginx \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--http-client-body-temp-path=/var/tmp/nginx/client/ \
--http-proxy-temp-path=/var/tmp/nginx/proxy/ \
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \
--with-pcre=../pcre-8.20 \
--with-ipv6 \
--without-mail_imap_module \
--without-mail_pop3_module \
--without-mail_smtp_module \
--add-module=../agentzh-echo-nginx-module-9259898
make
sudo make install
# Create subdirectories
mkdir -p /var/tmp/nginx/client
# mkdir -p /var/tmp/nginx/proxy
# mkdir -p /var/tmp/nginx/fcgi
# Create group and add it user.
if id -u nginx >/dev/null 2>nginx; then
echo "The nginx user exists"
else
sudo groupadd nginx
sudo useradd -r -g nginx nginx
fi
# install the init script
wget 'https://raw.github.com/JasonGiedymin/nginx-init-ubuntu/master/nginx' -O /etc/init.d/nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment