Skip to content

Instantly share code, notes, and snippets.

@glidenote
Last active August 29, 2015 14:02
Show Gist options
  • Save glidenote/335894e6e0ba84021824 to your computer and use it in GitHub Desktop.
Save glidenote/335894e6e0ba84021824 to your computer and use it in GitHub Desktop.
build nginx with vagrant
#!/bin/sh
export LANG=C
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NGINX_VER="1.7.1"
yum -y groupinstall 'Development Tools'
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum -y install wget yum-utils
yum -y install pcre-devel lua-devel openssl-devel gd-devel geoip-devel
if [ -d /tmp/build ]; then
rm -rf /tmp/build
fi
mkdir -p /tmp/build/
cd /tmp/build/
wget http://nginx.org/download/nginx-${NGINX_VER}.tar.gz
tar zxvf nginx-${NGINX_VER}.tar.gz
cd nginx-${NGINX_VER}
# git clone modules
git clone https://github.com/openresty/lua-nginx-module /usr/local/src/lua-nginx-module
# configure option
./configure \
--prefix=/etc/nginx \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/run/nginx.lock \
--http-client-body-temp-path=/var/cache/nginx/client_temp \
--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
--http-scgi-temp-path=/var/cache/nginx/scgi_temp \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_stub_status_module \
--with-file-aio \
--with-ipv6 \
--with-pcre \
--with-http_geoip_module \
--with-http_image_filter_module \
--with-http_stub_status_module \
--add-module=/usr/local/src/lua-nginx-module/ \
--with-cc-opt='-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic'
make
/tmp/build/nginx-${NGINX_VER}/objs/nginx -V
echo "Done!!"
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# sensu-server
config.vm.define :build001 do |server|
server.vm.box = "CentOS6.5-x86_64"
server.vm.box_url = "https://github.com/2creatives/vagrant-centos/releases/download/v6.5.3/centos65-x86_64-20140116.box"
server.vm.provision "shell", path: "provision.sh"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment