Mastering Nginx

(Ron) #1
Chapter 1

[ 19 ]

Keep in mind that many third-party modules are of an experimental nature. Test


using a module first before rolling it out on production systems. And remember that
the development releases of NGINX may have API changes that can cause problems


with third-party modules.


Special mention should be made here of the ngx_lua third-party module.


The ngx_lua module serves to enable Lua instead of Perl as a configuration time
embedded scripting language. The great advantage this module has over the perl


module is its non-blocking nature and tight integration with other third-party
modules. The installation instructions are fully described at http://wiki.nginx.


org/HttpLuaModule#Installation. We will be using this module as an example


of installing a third-party module in the next section.


Putting it all together


Now that you have gotten a glimpse at what all the various configuration options


are for, you can design a binary that precisely fits your needs. The following example
specifies the prefix, user, group, certain paths, disables some modules, enables some


others, and includes a couple of third-party modules:


$ export BUILD_DIR=`pwd`
$ export NGINX_INSTALLDIR=/opt/nginx
$ export VAR_DIR=/home/www/tmp
$ export LUAJIT_LIB=/opt/luajit/lib
$ export LUAJIT_INC=/opt/luajit/include/luajit-2.0

$ ./configure \
--prefix=${NGINX_INSTALLDIR} \
--user=www \
--group=www \
--http-client-body-temp-path=${VAR_DIR}/client_body_temp \
--http-proxy-temp-path=${VAR_DIR}/proxy_temp \
--http-fastcgi-temp-path=${VAR_DIR}/fastcgi_temp \
--without-http_uwsgi_module \
--without-http_scgi_module \
--without-http_browser_module \
--with-openssl=${BUILD_DIR}/../openssl-1.0.1c \
--with-pcre=${BUILD_DIR}/../pcre-8.32 \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_sub_module \
--with-http_flv_module \
--with-http_gzip_static_module \
Free download pdf