1. 基本构建,提供最简单的http服务
cd nginx-1.2.6APPDIR=/home/s/apps/nginxLOGDIR=/home/s/logs/nginx./configure \ --prefix=$APPDIR \ --error-log-path=$LOGDIR/error.log \ --pid-path=$LOGDIR/nginx.pid \ --lock-path=$LOGDIR/nginx.lock \ --http-log-path=$LOGDIR/access.log \ --without-pcre \ --without-http_rewrite_module \ --without-http_gzip_module \ --with-http_stub_status_module \ --http-client-body-temp-path=$LOGDIR/client/ \ --http-proxy-temp-path=$LOGDIR/proxy/ \ --http-fastcgi-temp-path=$LOGDIR/fastcgi/ \ --http-uwsgi-temp-path=$LOGDIR/uwsgi/ \ --http-scgi-temp-path=$LOGDIR/scgi/ \ --user=search \ --group=search make && make install
2. 构建 nginx + redis
# wget --no-check-certificate https://github.com/agentzh/redis2-nginx-module/archive/v0.09.tar.gzREDIS_NGINX_DIR=$APPDIR/redis2-nginx-module-0.09cd nginx-1.2.6APPDIR=/home/s/apps/lab/nginx.redisLOGDIR=/home/s/logs/lab/nginx.redis./configure \ --prefix=$APPDIR \ --error-log-path=$LOGDIR/error.log \ --pid-path=$LOGDIR/nginx.pid \ --lock-path=$LOGDIR/nginx.lock \ --http-log-path=$LOGDIR/access.log \ --without-pcre \ --without-http_rewrite_module \ --without-http_gzip_module \ --with-http_stub_status_module \ --http-client-body-temp-path=$LOGDIR/client/ \ --http-proxy-temp-path=$LOGDIR/proxy/ \ --http-fastcgi-temp-path=$LOGDIR/fastcgi/ \ --http-uwsgi-temp-path=$LOGDIR/uwsgi/ \ --http-scgi-temp-path=$LOGDIR/scgi/ \ --add-module=$REDIS_NGINX_DIR \ --user=search \ --group=search make && make install
3. 构建 Nginx + Perl
## yum -y install perl-devel perl-ExtUtils-Embedcd nginx-1.6.0APPDIR=/home/s/apps/nginx.pl5LOGDIR=/home/s/logs/nginx.pl5LIBDIR=$APPDIR/perl./configure \ --prefix=$APPDIR \ --error-log-path=$LOGDIR/error.log \ --pid-path=$LOGDIR/nginx.pid \ --lock-path=$LOGDIR/nginx.lock \ --http-log-path=$LOGDIR/access.log \ --without-pcre \ --without-http_rewrite_module \ --without-http_gzip_module \ --with-http_stub_status_module \ --with-http_perl_module \ --with-perl_modules_path=$LIBDIR \ --http-client-body-temp-path=$LOGDIR/client/ \ --http-proxy-temp-path=$LOGDIR/proxy/ \ --http-fastcgi-temp-path=$LOGDIR/fastcgi/ \ --http-uwsgi-temp-path=$LOGDIR/uwsgi/ \ --http-scgi-temp-path=$LOGDIR/scgi/ \ --user=search \ --group=search make && make install## before run sbin/nginx## add following configure to 'http' context## perl_modules /home/s/apps/nginx.pl5/perl/x86_64-linux-thread-multi;## perl_modules perl/lib;## perl_require test.pm;#### add following configure to 'server' context## location /user/ {## perl pkg_name::process;## }##
4. Nginx + LuaJIT
cd $(dirname $0)WDIR=$(pwd)LUAJIT_HOME=/home/s/apps/luajitexport LUAJIT_LIB=$LUAJIT_HOME/libexport LUAJIT_INC=$LUAJIT_HOME/include/luajit-2.0# or tell where to find Lua if using Lua instead:#export LUA_LIB=/path/to/lua/lib#export LUA_INC=/path/to/lua/includecd nginx-1.6.0APPDIR=/home/s/apps/nginx.luaLOGDIR=/home/s/logs/nginx.lua./configure \ --prefix=$APPDIR \ --error-log-path=$LOGDIR/error.log \ --pid-path=$LOGDIR/nginx.pid \ --lock-path=$LOGDIR/nginx.lock \ --http-log-path=$LOGDIR/access.log \ --with-http_stub_status_module \ --http-client-body-temp-path=$LOGDIR/client/ \ --http-proxy-temp-path=$LOGDIR/proxy/ \ --http-fastcgi-temp-path=$LOGDIR/fastcgi/ \ --http-uwsgi-temp-path=$LOGDIR/uwsgi/ \ --http-scgi-temp-path=$LOGDIR/scgi/ \ --user=search \ --group=search \ --add-module=$WDIR/ngx_devel_kit \ --add-module=$WDIR/lua-nginx-modulemake && make install## if no libluajit*.so to be linked,## 1. rm -f libluajit*.so*## 2. add "-ldl" to lua-nginx-module/config : -L$LUAJIT_LIB -lluajit-5.1 -ldl -lm#### in develop mode, add this directive into "server" section## lua_code_cache off;##
5. Tengine
cd $(dirname $0)WDIR=$(pwd)LUAJIT_HOME=/home/s/apps/luajitexport LUAJIT_LIB=$LUAJIT_HOME/libexport LUAJIT_INC=$LUAJIT_HOME/include/luajit-2.0# or tell where to find Lua if using Lua instead:#export LUA_LIB=/path/to/lua/lib#export LUA_INC=/path/to/lua/includecd tengine-2.0.2APPDIR=/home/s/apps/tengineLOGDIR=/home/s/logs/tengineLIBDIR=$APPDIR/perl./configure \ --prefix=$APPDIR \ --error-log-path=$LOGDIR/error.log \ --pid-path=$LOGDIR/nginx.pid \ --lock-path=$LOGDIR/nginx.lock \ --http-log-path=$LOGDIR/access.log \ --with-http_stub_status_module \ --with-http_perl_module \ --with-perl_modules_path=$LIBDIR \ --http-client-body-temp-path=$LOGDIR/client/ \ --http-proxy-temp-path=$LOGDIR/proxy/ \ --http-fastcgi-temp-path=$LOGDIR/fastcgi/ \ --http-uwsgi-temp-path=$LOGDIR/uwsgi/ \ --http-scgi-temp-path=$LOGDIR/scgi/ \ --user=search \ --group=search \ --enable-mods-static=all make && make install## if no libluajit*.so to be linked,## 1. rm -f libluajit*.so*## 2. add "-ldl" to tengine-2.0.2/auto/lib/lua/conf : -L$LUAJIT_LIB -lluajit-5.1 -ldl -lm
X1. 显示Nginx运行状态
location /nginx_status { stub_status on; access_log off; allow SOME.IP.ADDRESS; deny all;}