Description: This is my custom nginx init script for ubuntu server 14.04.1 based on JasonGiedymin's config.
Note: This script is intended for use with my nginx configuration files, which can be found here.
apt-get install libpcre3-dev zlib1g-dev -y
apt-get install build-essential -y
apt-get install python-software-properties -y
apt-get install software-properties-common -y
mkdir -p /usr/share/downloads
cd /usr/share/downloads
wget http://nginx.org/download/nginx-1.6.2.tar.gz
tar -xvf nginx-1.6.2.tar.gz
wget https://github.com/openresty/headers-more-nginx-module/archive/v0.25.tar.gz
tar -xvf v0.25.tar.gz
wget https://github.com/FRiCKLE/ngx_cache_purge/archive/2.1.tar.gz
tar -xvf 2.1.tar.gz
cd nginx-1.6.2
./configure --prefix=/etc/nginx --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --user=nginx --group=nginx --add-module=/usr/share/downloads/headers-more-nginx-module-0.25 --add-module=/usr/share/downloads/ngx_cache_purge-2.1
make && make install
nano /etc/nginx/conf/nginx.conf
Copy and replace everything in that file with my nginx.conf file found here.
adduser --system --no-create-home --disabled-login --disabled-password --group nginx
wget https://raw.githubusercontent.com/greenzwiz/ubuntu-init-nginx/master/nginx -O /etc/init.d/nginx
chmod +x /etc/init.d/nginx
/usr/sbin/update-rc.d -f nginx defaults