nginx 点滴

1. 基本构建,提供最简单的http服务

cd nginx-1.2.6
APPDIR=/home/s/apps/nginx
LOGDIR=/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.gz
REDIS_NGINX_DIR=$APPDIR/redis2-nginx-module-0.09

cd nginx-1.2.6


APPDIR=/home/s/apps/lab/nginx.redis
LOGDIR=/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-Embed

cd nginx-1.6.0

APPDIR=/home/s/apps/nginx.pl5
LOGDIR=/home/s/logs/nginx.pl5
LIBDIR=$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/luajit
export LUAJIT_LIB=$LUAJIT_HOME/lib
export 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/include


cd nginx-1.6.0
APPDIR=/home/s/apps/nginx.lua
LOGDIR=/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-module
make && 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/luajit
export LUAJIT_LIB=$LUAJIT_HOME/lib
export 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/include


cd tengine-2.0.2
APPDIR=/home/s/apps/tengine
LOGDIR=/home/s/logs/tengine
LIBDIR=$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;
}

转载于:https://my.oschina.net/kuerant/blog/226454

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值