The following is the Nginx installation configuration
(1) The LIBMAXMINDDB dependent library needs to be installed first. LIBMAXMINDDB is a C library file that reads Maxmind DB files, including GeoIP2 data files under Maxmind.
$ cd/usr/local/src
$ git clone--recursive https://github.com/maxmind/libmaxminddb
$ CD LIBMAXMINDDB
$./bootstrap
$./configure
$ make
$ make Install
$ sh-c "Echo/usr/local/lib >>/etc/ld.so.conf.d/local.conf"
$ ldconfig
(2) Recompile the Ngx_http_geoip2_module module. The original Nginx band –with-http_geoip_module used is the first generation of GeoIP (GEOIP1). GEOIP2 is not yet joined in the module.
#获取ngx_http_geoip2_module
#cd/usr/local/src && git clone--recursive https://github.com/leev/ngx_http_geoip2_module
#查看原nginx编译参数
# nginx-v
Nginx version:nginx/1.6.2
Built by GCC 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
TLS SNI Support Enabled
Configure arguments:--prefix=/opt/webserver/nginx--without-http_memcached_module--user=www--group=www-- With-http_image_filter_module--with-http_stub_status_module--with-http_ssl_module--with-http_gzip_static_ Module--WITH-OPENSSL=/USR/LOCAL/SRC/OPENSSL-1.0.1J--with-zlib=/usr/local/src/zlib-1.2.8--with-pcre=/usr/local/ src/pcre-8.36--with-http_sub_module--add-module=/usr/local/src/nginx-accesskey-2.0.3--with-http_realip_module- -with-http_mp4_module
#添加模块, recompile compilation Nginx
#cd/usr/local/src/nginx-1.6.2 &&
./configure--prefix=/opt/webserver/nginx \
--without-http_memcached_module \
--USER=WWW \
--GROUP=WWW \
--with-http_image_filter_module \
--with-http_stub_status_module \
--with-http_ssl_module \
--with-http_gzip_static_module \
--WITH-OPENSSL=/USR/LOCAL/SRC/OPENSSL-1.0.1J \
--with-zlib=/usr/local/src/zlib-1.2.8 \
--with-pcre=/usr/local/src/pcre-8.36 \
--with-http_sub_module \
--add-module=/usr/local/src/nginx-accesskey-2.0.3 \
--add-module=/usr/local/src/ngx_http_geoip2_module \
--with-http_realip_module \
--with-http_mp4_module &&
Make
#备份原nginx程序文件
#mv/opt/webserver/nginx/sbin/nginx/opt/webserver/nginx/sbin/nginx.bak &&
\CP Objs/nginx/opt/webserver/nginx/sbin/nginx &&
Nginx-t
#测试没有问题, upgrade Nginx
#make Upgrade
(3) Simple configuration nginx.conf sample