操作系统

ubuntu 14.04 LTS


Nginx-GridFS为nginx直接访问mongoDB的扩展模块,目前只支持到mongodb2.6.12


mongodb安装请自己百度




#安装依赖包保平安

apt-get install root-system-bin autoconf automake gcc c++ libgeoip-dev libxml++2.6-dev libxslt1-dev libxslt1.1 libgd-dev build-essential libyajl-dev git libreadline6 libreadline6-dev



#下载相关软件源码包

wget https://github.com/jemalloc/jemalloc/releases/download/4.2.1/jemalloc-4.2.1.tar.bz2

wget http://tengine.taobao.org/download/tengine-2.1.2.tar.gz

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.39.tar.gz

wget http://zlib.net/zlib-1.2.8.tar.gz

wget http://www.lua.org/ftp/lua-5.3.3.tar.gz

wget http://luajit.org/download/LuaJIT-2.0.4.tar.gz

wget https://openssl.org/source/openssl-1.0.2h.tar.gz


#解压

tar zxvf tengine-2.1.2.tar.gz

tar zxvf pcre-8.39.tar.gz 

tar zxvf zlib-1.2.8.tar.gz 

tar zxvf openssl-1.0.2h.tar.gz 

tar zxvf LuaJIT-2.0.4.tar.gz 

tar zxvf lua-5.3.3.tar.gz 

tar jxvf jemalloc-4.2.1



#下载nginx的gridfs插件

git clone https://github.com/barakav/gridfs-nginx-plugin.git

cd gridfs-nginx-plugin

git clone https://github.com/eagleas/mongo-c-driver.git

cd mongo-c-driver/

git checkout v0.7.1




#编译安装组件

cd lua-5.3.3/

make linux

make install


cd LuaJIT-2.0.4/

make

make install


cd jemalloc-4.2.1/

./configure

make

make install



#设置全局变量

vim /etc/profile

export LUAJIT_LIB=/usr/local/lib

export LUAJIT_INC=/usr/local/include/luajit-2.0

export JEMALLOC_INCLUDEDIR=/usr/local/include/jemalloc

export JEMALLOC_LIBDIR=/usr/local/lib


source /etc/profile



#建议安装目录

mkdir -p /opt/tengine/dso-path


#编译安装tengine

cd /opt/tengine-2.1.2


./configure --prefix=/opt/tengine \

--dso-path=/opt/tengine/dso-path \

--with-rtsig_module \

--with-select_module \

--with-file-aio \

--with-http_v2_module \

--with-http_realip_module \

--with-http_addition_module \

--with-http_geoip_module \

--with-http_sub_module \

--with-http_dav_module \

--with-http_flv_module \

--with-http_mp4_module \

--with-http_dyups_module \

--with-http_gunzip_module \

--with-http_gzip_static_module \

--with-http_auth_request_module \

--with-http_concat_module \

--with-http_sysguard_module \

--with-http_lua_module \

--add-module=../gridfs-nginx-plugin \

--with-pcre=../pcre-8.39 \

--with-zlib=../zlib-1.2.8 \

--with-jemalloc \

--with-openssl=../openssl-1.0.2h \


make

make install


完事抽身去,深藏功与名~~~