基础知识:
https://blog.csdn.net/u010710458/article/details/79890155
https://blog.csdn.net/u010710458/article/details/79900837
解剖 Nginx ·自动脚本篇(1)解析配置选项脚本 auto/options
- Author: Poechant
- Blog: blog.CSDN.net/Poechant
- Email: zhongchao.ustc#gmail.com (#->@)
- Date: March 4th, 2012
- Copyright © 柳大·Poechant
在安装Nginx
之前(即运行make
脚本之前),首先是进行安装的配置准备,包括环境检查及生成文件。这些工作是由自动脚本完成的。和绝大多数软件一样,Nginx
的自动脚本的入口,同样是名为configure
的文件。
除了configure
,其他的自动脚本都在auto
目录下。通过分析configure
脚本源码,我们可以看到,configure
首先运行了auto
目录下的几个自动脚本,如下:
. auto/options
. auto/init
. auto/sources
其中通过运行auto/options
脚本,来设定配置选项。下面将逐步分析auto/options
脚本是如何工作的。
1 读取configure
配置参数
开始先声明了 N 多变量,然后最主要的部分从这段开始:
opt=
for option
do
...
done
这段实际上是处理运行./configure
的时候携带的参数选项,for
循环每次对应一个参数选项 option。要注意for
循环体上面有一个全局的opt
变量。这个循环体内的第一个语句是最重要是,它是:
opt="$opt `echo $option | sed -e \"s/\(--[^=]*=\)\(.* .*\)/\1'\2'/\"`"
通过循环运行该语句后,opt
的值就是一个由空格来分隔的参数列表。然后在循环体中接下来是一个case-esac
,用来得到参数值,如下:
case "$option" in
-*=*) value=`echo "$option" | sed -e 's/[-_a-zA-Z0-9]*=//'` ;;
*) value="" ;;
esac
其含义是将value
赋值为参数选项值,如果选项值不与-*=*
的模式匹配,则value
值为""
。接下来的case-esac
语句用来匹配参数的类型。
case "$option" in
--help) help=yes ;;
--prefix=) NGX_PREFIX="!" ;;
--prefix=*) NGX_PREFIX="$value" ;;
--sbin-path=*) NGX_SBIN_PATH="$value" ;;
--conf-path=*) NGX_CONF_PATH="$value" ;;
...
esac
各匹配的分支语句中进行配置变量的赋值。这些变量在auto/options
脚本的最开始处赋以默认值,其中那些模块配置变量被赋以YES
的表示默认开启,赋以NO
的表示默认关闭。但它们开启与否由这个auto/options
中的case-esac
语句来决定。还有一些是安装相关的选项变量也在这里被赋值,比如:
-
prefix
参数值被赋予NGX_PREFIX
-
sbin-path
参数值被赋予NGX_SBIN_PATH
-
conf-path
参数值被赋予NGX_CONF_PATH
-
error-log-path
参数值被赋予NGX_ERROR_LOG_PATH
-
pid-path
参数值被赋予NGX_PID_PATH
-
lock-path
参数值被赋予NGX_LOCK_PATH
如果option
并不符合预设的这些匹配,也就是用户使用configure
脚本的时候携带的参数错误,则auto/options
会匹配该语句:
*)
echo "$0: error: invalid option \"$option\""
exit 1
从而提示用户参数错误,并使脚本退出运行。经过多次循环,for-do-done
就结束。
2 设定NGX_CONFIGURE
变量
处理完所有option
后,opt
就如我们上面提到的,成为由空格分割的配置项值,并被赋给NGX_CONFIGURE
变量:
NGX_CONFIGURE="$opt"
3 是否显示configure
的帮助信息
再看下面这句:
if [ $help = yes ]; then
cat << END
…
END
exit 1
fi
默认情况下$help</code>变量值在初始化时就为<code style="background-color:rgb(248,248,248);border-top-width:1px;border-right-width:1px;border-bottom-width:1px;border-left-width:1px;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:rgb(234,234,234);border-right-color:rgb(234,234,234);border-bottom-color:rgb(234,234,234);border-left-color:rgb(234,234,234);margin-top:0px;margin-right:2px;margin-bottom:0px;margin-left:2px;padding-top:0px;padding-right:5px;padding-bottom:0px;padding-left:5px;white-space:nowrap;">no</code>。如果<code style="background-color:rgb(248,248,248);border-top-width:1px;border-right-width:1px;border-bottom-width:1px;border-left-width:1px;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:rgb(234,234,234);border-right-color:rgb(234,234,234);border-bottom-color:rgb(234,234,234);border-left-color:rgb(234,234,234);margin-top:0px;margin-right:2px;margin-bottom:0px;margin-left:2px;padding-top:0px;padding-right:5px;padding-bottom:0px;padding-left:5px;white-space:nowrap;">configure</code>选项中指定了<code style="background-color:rgb(248,248,248);border-top-width:1px;border-right-width:1px;border-bottom-width:1px;border-left-width:1px;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:rgb(234,234,234);border-right-color:rgb(234,234,234);border-bottom-color:rgb(234,234,234);border-left-color:rgb(234,234,234);margin-top:0px;margin-right:2px;margin-bottom:0px;margin-left:2px;padding-top:0px;padding-right:5px;padding-bottom:0px;padding-left:5px;white-space:nowrap;">help</code>参数,则<code style="background-color:rgb(248,248,248);border-top-width:1px;border-right-width:1px;border-bottom-width:1px;border-left-width:1px;border-top-style:solid;border-right-style:solid;border-bottom-style:solid;border-left-style:solid;border-top-color:rgb(234,234,234);border-right-color:rgb(234,234,234);border-bottom-color:rgb(234,234,234);border-left-color:rgb(234,234,234);margin-top:0px;margin-right:2px;margin-bottom:0px;margin-left:2px;padding-top:0px;padding-right:5px;padding-bottom:0px;padding-left:5px;white-space:nowrap;">$help
参数为yes
,则会运行cat
命令,显示大段的帮助信息,然后退出。
4 是否关闭 HTTP 功能
默认情况下HTTP
的一些基本功能是被开启的,如果用户指定了--without-http
参数,则变量HTTP
会被赋值为NO
,则下面这段代码if-fi
中的语句会被执行:
if [ $HTTP = NO ]; then
HTTP_CHARSET=NO
HTTP_GZIP=NO
HTTP_SSI=NO
HTTP_USERID=NO
HTTP_ACCESS=NO
HTTP_STATUS=NO
HTTP_REWRITE=NO
HTTP_PROXY=NO
HTTP_FASTCGI=NO
fi
5 是否指定运行于 Windows 平台
如果显式指定了--crossbuild
参数,则变量NGX_PLATFORM
会被赋予当前for-do-done
循环中的"$value"
值,也就是--crossbuild
的参数值,一般在考虑在Windows
平台使用时才会用到,看下面的语句:
if [ ".$NGX_PLATFORM" = ".win32" ]; then
NGX_WINE=$WINE
fi
如果指定--crossbuild=win32
,则NGX_WINE
就会被赋值了。
6 Nginx 配置文件路径
在加载configure
的参数时,如果没有指定了--conf-path
参数,则$NGX_CONF_PATH
变量是没有值的,则下面的语句会为NGX_CONF_PATH
赋以conf/nginx.conf
的缺省值。不过我在想老毛子 Igor Sysoev 同学完全可以在auto/options
开始处和其他参数一样先指定NGX_CONF_PATH
的默认值。
NGX_CONF_PATH=${NGX_CONF_PATH:-conf/nginx.conf}
然后获取配置文件所在目录的:
NGX_CONF_PREFIX=`dirname $NGX_CONF_PATH`
如果指定参数--conf-path=/home/michael/nginx/conf/nginx.conf
,则NGX_CONF_PREFIX
的值就是/home/michael/nginx/conf
。
7 Nginx 进程 ID 文件和锁文件路径
下面是同样的方式初始化NGX_PID_PATH
和NGX_LOCK_PATH
,分别对应configure
参数--pid-path
和--lock-path
,其缺省值分别为logs/nginx.pid
和logs/nginx.lock
。
NGX_PID_PATH=${NGX_PID_PATH:-logs/nginx.pid}
NGX_LOCK_PATH=${NGX_LOCK_PATH:-logs/nginx.lock}
关于nginx 我测试的是,只有启动nginx后才能出现nginx.pid
8 错误日志文件路径
如果指定了参数--error-log-path
则NGX_ERROR_LOG_PATH
变量的值会被指定,根据下面的语句,如果指定的是stderr
则将NGX_ERROR_LOG_PATH
修改为空,即不需要错误日志文件。如果不是标准输出,且其值为空,则设置为缺省值logs/error.log
。
if [ ".$NGX_ERROR_LOG_PATH" = ".stderr" ]; then
NGX_ERROR_LOG_PATH=
else
NGX_ERROR_LOG_PATH=${NGX_ERROR_LOG_PATH:-logs/error.log}
fi
9 HTTP 相关各路径
NGX_HTTP_LOG_PATH=${NGX_HTTP_LOG_PATH:-logs/access.log}
NGX_HTTP_CLIENT_TEMP_PATH=${NGX_HTTP_CLIENT_TEMP_PATH:-client_body_temp}
NGX_HTTP_PROXY_TEMP_PATH=${NGX_HTTP_PROXY_TEMP_PATH:-proxy_temp}
NGX_HTTP_FASTCGI_TEMP_PATH=${NGX_HTTP_FASTCGI_TEMP_PATH:-fastcgi_temp}
NGX_HTTP_UWSGI_TEMP_PATH=${NGX_HTTP_UWSGI_TEMP_PATH:-uwsgi_temp}
NGX_HTTP_SCGI_TEMP_PATH=${NGX_HTTP_SCGI_TEMP_PATH:-scgi_temp}
10 Perl 模块
如果指定了--with-perl_modules_path
参数,则NGX_PERL_MODULES
变量即被设定。如果指定的值为一个绝对路径或未指定(空),则当做相对路径来处理,设定为$NGX_PREFIX/$NGX_PERL_MODULES
。
case ".$NGX_PERL_MODULES" in
./*)
;;
.)
;;
*)
NGX_PERL_MODULES=$NGX_PREFIX/$NGX_PERL_MODULES
;;
esac
11 小结
通过运行auto/options
脚本,所有的配置项已经被正确解析并加载到相应的配置变量中了。
完整的options脚本
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
#auto/options主是处理用户输入的configure选项,以及输出帮助信息等
##1. 设置选项对应的shell变量以及他们的初始值
help=no
NGX_PREFIX=
NGX_SBIN_PATH=
NGX_CONF_PREFIX=
NGX_CONF_PATH=
NGX_ERROR_LOG_PATH=
NGX_PID_PATH=
NGX_LOCK_PATH=
NGX_USER=
NGX_GROUP=
CC=${CC:-cc}
CPP=
NGX_OBJS=objs #定义NGX_OBJS变量
NGX_DEBUG=NO
NGX_CC_OPT=
NGX_LD_OPT=
CPU=NO
NGX_RPATH=NO
NGX_TEST_BUILD_DEVPOLL=NO
NGX_TEST_BUILD_EVENTPORT=NO
NGX_TEST_BUILD_EPOLL=NO
NGX_TEST_BUILD_RTSIG=NO
NGX_TEST_BUILD_SOLARIS_SENDFILEV=NO
NGX_PLATFORM=
NGX_WINE=
EVENT_FOUND=NO
EVENT_RTSIG=NO
EVENT_SELECT=NO
EVENT_POLL=NO
EVENT_AIO=NO
USE_THREADS=NO
NGX_FILE_AIO=NO
NGX_IPV6=NO
HTTP=YES
NGX_HTTP_LOG_PATH=
NGX_HTTP_CLIENT_TEMP_PATH=
NGX_HTTP_PROXY_TEMP_PATH=
NGX_HTTP_FASTCGI_TEMP_PATH=
NGX_HTTP_UWSGI_TEMP_PATH=
NGX_HTTP_SCGI_TEMP_PATH=
HTTP_CACHE=YES
HTTP_CHARSET=YES
HTTP_GZIP=YES
HTTP_SSL=NO
HTTP_SPDY=NO
HTTP_SSI=YES
HTTP_POSTPONE=NO
HTTP_REALIP=NO
HTTP_XSLT=NO
HTTP_IMAGE_FILTER=NO
HTTP_SUB=NO
HTTP_ADDITION=NO
HTTP_DAV=NO
HTTP_ACCESS=YES
HTTP_AUTH_BASIC=YES
HTTP_AUTH_REQUEST=NO
HTTP_USERID=YES
HTTP_AUTOINDEX=YES
HTTP_RANDOM_INDEX=NO
HTTP_STATUS=NO
HTTP_GEO=YES
HTTP_GEOIP=NO
HTTP_MAP=YES
HTTP_SPLIT_CLIENTS=YES
HTTP_REFERER=YES
HTTP_REWRITE=YES
HTTP_PROXY=YES
HTTP_FASTCGI=YES
HTTP_UWSGI=YES
HTTP_SCGI=YES
HTTP_PERL=NO
HTTP_MEMCACHED=YES
HTTP_LIMIT_CONN=YES
HTTP_LIMIT_REQ=YES
HTTP_EMPTY_GIF=YES
HTTP_BROWSER=YES
HTTP_SECURE_LINK=NO
HTTP_DEGRADATION=NO
HTTP_FLV=NO
HTTP_MP4=NO
HTTP_GUNZIP=NO
HTTP_GZIP_STATIC=NO
HTTP_UPSTREAM_IP_HASH=YES
HTTP_UPSTREAM_LEAST_CONN=YES
HTTP_UPSTREAM_KEEPALIVE=YES
# STUB
HTTP_STUB_STATUS=NO
MAIL=NO
MAIL_SSL=NO
MAIL_POP3=YES
MAIL_IMAP=YES
MAIL_SMTP=YES
NGX_ADDONS=
USE_PCRE=NO
PCRE=NONE
PCRE_OPT=
PCRE_CONF_OPT=
PCRE_JIT=NO
USE_OPENSSL=NO
OPENSSL=NONE
USE_MD5=NO
MD5=NONE
MD5_OPT=
MD5_ASM=NO
USE_SHA1=NO
SHA1=NONE
SHA1_OPT=
SHA1_ASM=NO
USE_ZLIB=NO
ZLIB=NONE
ZLIB_OPT=
ZLIB_ASM=NO
USE_PERL=NO
NGX_PERL=perl
USE_LIBXSLT=NO
USE_LIBGD=NO
NGX_GOOGLE_PERFTOOLS=NO
NGX_CPP_TEST=NO
NGX_LIBATOMIC=NO
NGX_CPU_CACHE_LINE=
NGX_POST_CONF_MSG=
opt=
## 2, 处理每一个选项值,并设置到对应的全局变量中
for option
do
opt=" $opt `echo $option | sed -e \"s/\(--[^=]*=\)\(.* .*\)/\1'\2'/\"` " #部分引用
#(--[^=]*=)(.* .*)
case "$option" in
-*=*) value=`echo "$option" | sed -e 's/[-_a-zA-Z0-9]*=//'` ;;
*) value="" ;;
esac
#得到此选项的value部分
case "$option" in
--help) help=yes ;;
--prefix=) NGX_PREFIX="!" ;;
--prefix=*) NGX_PREFIX="$value" ;;
--sbin-path=*) NGX_SBIN_PATH="$value" ;;
--conf-path=*) NGX_CONF_PATH="$value" ;;
--error-log-path=*) NGX_ERROR_LOG_PATH="$value";;
--pid-path=*) NGX_PID_PATH="$value" ;;
--lock-path=*) NGX_LOCK_PATH="$value" ;;
--user=*) NGX_USER="$value" ;;
--group=*) NGX_GROUP="$value" ;;
--crossbuild=*) NGX_PLATFORM="$value" ;;
--builddir=*) NGX_OBJS="$value" ;;
--with-rtsig_module) EVENT_RTSIG=YES ;;
--with-select_module) EVENT_SELECT=YES ;;
--without-select_module) EVENT_SELECT=NONE ;;
--with-poll_module) EVENT_POLL=YES ;;
--without-poll_module) EVENT_POLL=NONE ;;
--with-aio_module) EVENT_AIO=YES ;;
#--with-threads=*) USE_THREADS="$value" ;;
#--with-threads) USE_THREADS="pthreads" ;;
--with-file-aio) NGX_FILE_AIO=YES ;;
--with-ipv6) NGX_IPV6=YES ;;
--without-http) HTTP=NO ;;
--without-http-cache) HTTP_CACHE=NO ;;
--http-log-path=*) NGX_HTTP_LOG_PATH="$value" ;;
--http-client-body-temp-path=*) NGX_HTTP_CLIENT_TEMP_PATH="$value" ;;
--http-proxy-temp-path=*) NGX_HTTP_PROXY_TEMP_PATH="$value" ;;
--http-fastcgi-temp-path=*) NGX_HTTP_FASTCGI_TEMP_PATH="$value" ;;
--http-uwsgi-temp-path=*) NGX_HTTP_UWSGI_TEMP_PATH="$value" ;;
--http-scgi-temp-path=*) NGX_HTTP_SCGI_TEMP_PATH="$value" ;;
--with-http_ssl_module) HTTP_SSL=YES ;;
--with-http_spdy_module) HTTP_SPDY=YES ;;
--with-http_realip_module) HTTP_REALIP=YES ;;
--with-http_addition_module) HTTP_ADDITION=YES ;;
--with-http_xslt_module) HTTP_XSLT=YES ;;
--with-http_image_filter_module) HTTP_IMAGE_FILTER=YES ;;
--with-http_geoip_module) HTTP_GEOIP=YES ;;
--with-http_sub_module) HTTP_SUB=YES ;;
--with-http_dav_module) HTTP_DAV=YES ;;
--with-http_flv_module) HTTP_FLV=YES ;;
--with-http_mp4_module) HTTP_MP4=YES ;;
--with-http_gunzip_module) HTTP_GUNZIP=YES ;;
--with-http_gzip_static_module) HTTP_GZIP_STATIC=YES ;;
--with-http_auth_request_module) HTTP_AUTH_REQUEST=YES ;;
--with-http_random_index_module) HTTP_RANDOM_INDEX=YES ;;
--with-http_secure_link_module) HTTP_SECURE_LINK=YES ;;
--with-http_degradation_module) HTTP_DEGRADATION=YES ;;
--without-http_charset_module) HTTP_CHARSET=NO ;;
--without-http_gzip_module) HTTP_GZIP=NO ;;
--without-http_ssi_module) HTTP_SSI=NO ;;
--without-http_userid_module) HTTP_USERID=NO ;;
--without-http_access_module) HTTP_ACCESS=NO ;;
--without-http_auth_basic_module) HTTP_AUTH_BASIC=NO ;;
--without-http_autoindex_module) HTTP_AUTOINDEX=NO ;;
--without-http_status_module) HTTP_STATUS=NO ;;
--without-http_geo_module) HTTP_GEO=NO ;;
--without-http_map_module) HTTP_MAP=NO ;;
--without-http_split_clients_module) HTTP_SPLIT_CLIENTS=NO ;;
--without-http_referer_module) HTTP_REFERER=NO ;;
--without-http_rewrite_module) HTTP_REWRITE=NO ;;
--without-http_proxy_module) HTTP_PROXY=NO ;;
--without-http_fastcgi_module) HTTP_FASTCGI=NO ;;
--without-http_uwsgi_module) HTTP_UWSGI=NO ;;
--without-http_scgi_module) HTTP_SCGI=NO ;;
--without-http_memcached_module) HTTP_MEMCACHED=NO ;;
--without-http_limit_zone_module)
HTTP_LIMIT_CONN=NO
NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG
$0: warning: the \"--without-http_limit_zone_module\" option is deprecated, \
use the \"--without-http_limit_conn_module\" option instead"
;;
--without-http_limit_conn_module) HTTP_LIMIT_CONN=NO ;;
--without-http_limit_req_module) HTTP_LIMIT_REQ=NO ;;
--without-http_empty_gif_module) HTTP_EMPTY_GIF=NO ;;
--without-http_browser_module) HTTP_BROWSER=NO ;;
--without-http_upstream_ip_hash_module) HTTP_UPSTREAM_IP_HASH=NO ;;
--without-http_upstream_least_conn_module)
HTTP_UPSTREAM_LEAST_CONN=NO ;;
--without-http_upstream_keepalive_module) HTTP_UPSTREAM_KEEPALIVE=NO ;;
--with-http_perl_module) HTTP_PERL=YES ;;
--with-perl_modules_path=*) NGX_PERL_MODULES="$value" ;;
--with-perl=*) NGX_PERL="$value" ;;
# STUB
--with-http_stub_status_module) HTTP_STUB_STATUS=YES ;;
--with-mail) MAIL=YES ;;
--with-mail_ssl_module) MAIL_SSL=YES ;;
# STUB
--with-imap) MAIL=YES ;;
--with-imap_ssl_module) MAIL_SSL=YES ;;
--without-mail_pop3_module) MAIL_POP3=NO ;;
--without-mail_imap_module) MAIL_IMAP=NO ;;
--without-mail_smtp_module) MAIL_SMTP=NO ;;
--with-google_perftools_module) NGX_GOOGLE_PERFTOOLS=YES ;;
--with-cpp_test_module) NGX_CPP_TEST=YES ;;
--add-module=*) NGX_ADDONS="$NGX_ADDONS $value" ;;
--with-cc=*) CC="$value" ;;
--with-cpp=*) CPP="$value" ;;
--with-cc-opt=*) NGX_CC_OPT="$value" ;;
--with-ld-opt=*) NGX_LD_OPT="$value" ;;
--with-cpu-opt=*) CPU="$value" ;;
--with-debug) NGX_DEBUG=YES ;;
--without-pcre) USE_PCRE=DISABLED ;;
--with-pcre) USE_PCRE=YES ;;
--with-pcre=*) PCRE="$value" ;;
--with-pcre-opt=*) PCRE_OPT="$value" ;;
--with-pcre-jit) PCRE_JIT=YES ;;
--with-openssl=*) OPENSSL="$value" ;;
--with-openssl-opt=*) OPENSSL_OPT="$value" ;;
--with-md5=*) MD5="$value" ;;
--with-md5-opt=*) MD5_OPT="$value" ;;
--with-md5-asm) MD5_ASM=YES ;;
--with-sha1=*) SHA1="$value" ;;
--with-sha1-opt=*) SHA1_OPT="$value" ;;
--with-sha1-asm) SHA1_ASM=YES ;;
--with-zlib=*) ZLIB="$value" ;;
--with-zlib-opt=*) ZLIB_OPT="$value" ;;
--with-zlib-asm=*) ZLIB_ASM="$value" ;;
--with-libatomic) NGX_LIBATOMIC=YES ;;
--with-libatomic=*) NGX_LIBATOMIC="$value" ;;
--test-build-devpoll) NGX_TEST_BUILD_DEVPOLL=YES ;;
--test-build-eventport) NGX_TEST_BUILD_EVENTPORT=YES ;;
--test-build-epoll) NGX_TEST_BUILD_EPOLL=YES ;;
--test-build-rtsig) NGX_TEST_BUILD_RTSIG=YES ;;
--test-build-solaris-sendfilev) NGX_TEST_BUILD_SOLARIS_SENDFILEV=YES ;;
*)
#没有找到的对应选项
echo "$0: error: invalid option \"$option\""
exit 1
;;
esac
done
NGX_CONFIGURE="$opt" #记录配置信息,其中opt的值就是一个由空格来分隔的参数列表
## 3. 对选项进行处理
#如果有--help,则输出帮助信息
if [ $help = yes ]; then
cat << END
--help print this message
--prefix=PATH set installation prefix
--sbin-path=PATH set nginx binary pathname
--conf-path=PATH set nginx.conf pathname
--error-log-path=PATH set error log pathname
--pid-path=PATH set nginx.pid pathname
--lock-path=PATH set nginx.lock pathname
--user=USER set non-privileged user for
worker processes
--group=GROUP set non-privileged group for
worker processes
--builddir=DIR set build directory
--with-rtsig_module enable rtsig module
--with-select_module enable select module
--without-select_module disable select module
--with-poll_module enable poll module
--without-poll_module disable poll module
--with-file-aio enable file AIO support
--with-ipv6 enable IPv6 support
--with-http_ssl_module enable ngx_http_ssl_module
--with-http_spdy_module enable ngx_http_spdy_module
--with-http_realip_module enable ngx_http_realip_module
--with-http_addition_module enable ngx_http_addition_module
--with-http_xslt_module enable ngx_http_xslt_module
--with-http_image_filter_module enable ngx_http_image_filter_module
--with-http_geoip_module enable ngx_http_geoip_module
--with-http_sub_module enable ngx_http_sub_module
--with-http_dav_module enable ngx_http_dav_module
--with-http_flv_module enable ngx_http_flv_module
--with-http_mp4_module enable ngx_http_mp4_module
--with-http_gunzip_module enable ngx_http_gunzip_module
--with-http_gzip_static_module enable ngx_http_gzip_static_module
--with-http_auth_request_module enable ngx_http_auth_request_module
--with-http_random_index_module enable ngx_http_random_index_module
--with-http_secure_link_module enable ngx_http_secure_link_module
--with-http_degradation_module enable ngx_http_degradation_module
--with-http_stub_status_module enable ngx_http_stub_status_module
--without-http_charset_module disable ngx_http_charset_module
--without-http_gzip_module disable ngx_http_gzip_module
--without-http_ssi_module disable ngx_http_ssi_module
--without-http_userid_module disable ngx_http_userid_module
--without-http_access_module disable ngx_http_access_module
--without-http_auth_basic_module disable ngx_http_auth_basic_module
--without-http_autoindex_module disable ngx_http_autoindex_module
--without-http_geo_module disable ngx_http_geo_module
--without-http_map_module disable ngx_http_map_module
--without-http_split_clients_module disable ngx_http_split_clients_module
--without-http_referer_module disable ngx_http_referer_module
--without-http_rewrite_module disable ngx_http_rewrite_module
--without-http_proxy_module disable ngx_http_proxy_module
--without-http_fastcgi_module disable ngx_http_fastcgi_module
--without-http_uwsgi_module disable ngx_http_uwsgi_module
--without-http_scgi_module disable ngx_http_scgi_module
--without-http_memcached_module disable ngx_http_memcached_module
--without-http_limit_conn_module disable ngx_http_limit_conn_module
--without-http_limit_req_module disable ngx_http_limit_req_module
--without-http_empty_gif_module disable ngx_http_empty_gif_module
--without-http_browser_module disable ngx_http_browser_module
--without-http_upstream_ip_hash_module
disable ngx_http_upstream_ip_hash_module
--without-http_upstream_least_conn_module
disable ngx_http_upstream_least_conn_module
--without-http_upstream_keepalive_module
disable ngx_http_upstream_keepalive_module
--with-http_perl_module enable ngx_http_perl_module
--with-perl_modules_path=PATH set Perl modules path
--with-perl=PATH set perl binary pathname
--http-log-path=PATH set http access log pathname
--http-client-body-temp-path=PATH set path to store
http client request body temporary files
--http-proxy-temp-path=PATH set path to store
http proxy temporary files
--http-fastcgi-temp-path=PATH set path to store
http fastcgi temporary files
--http-uwsgi-temp-path=PATH set path to store
http uwsgi temporary files
--http-scgi-temp-path=PATH set path to store
http scgi temporary files
--without-http disable HTTP server
--without-http-cache disable HTTP cache
--with-mail enable POP3/IMAP4/SMTP proxy module
--with-mail_ssl_module enable ngx_mail_ssl_module
--without-mail_pop3_module disable ngx_mail_pop3_module
--without-mail_imap_module disable ngx_mail_imap_module
--without-mail_smtp_module disable ngx_mail_smtp_module
--with-google_perftools_module enable ngx_google_perftools_module
--with-cpp_test_module enable ngx_cpp_test_module
--add-module=PATH enable an external module
--with-cc=PATH set C compiler pathname
--with-cpp=PATH set C preprocessor pathname
--with-cc-opt=OPTIONS set additional C compiler options
--with-ld-opt=OPTIONS set additional linker options
--with-cpu-opt=CPU build for the specified CPU, valid values:
pentium, pentiumpro, pentium3, pentium4,
athlon, opteron, sparc32, sparc64, ppc64
--without-pcre disable PCRE library usage
--with-pcre force PCRE library usage
--with-pcre=DIR set path to PCRE library sources
--with-pcre-opt=OPTIONS set additional build options for PCRE
--with-pcre-jit build PCRE with JIT compilation support
--with-md5=DIR set path to md5 library sources
--with-md5-opt=OPTIONS set additional build options for md5
--with-md5-asm use md5 assembler sources
--with-sha1=DIR set path to sha1 library sources
--with-sha1-opt=OPTIONS set additional build options for sha1
--with-sha1-asm use sha1 assembler sources
--with-zlib=DIR set path to zlib library sources
--with-zlib-opt=OPTIONS set additional build options for zlib
--with-zlib-asm=CPU use zlib assembler sources optimized
for the specified CPU, valid values:
pentium, pentiumpro
--with-libatomic force libatomic_ops library usage
--with-libatomic=DIR set path to libatomic_ops library sources
--with-openssl=DIR set path to OpenSSL library sources
--with-openssl-opt=OPTIONS set additional build options for OpenSSL
--with-debug enable debug logging
END
exit 1
fi
if [ $HTTP = NO ]; then
HTTP_CHARSET=NO
HTTP_GZIP=NO
HTTP_SSI=NO
HTTP_USERID=NO
HTTP_ACCESS=NO
HTTP_STATUS=NO
HTTP_REWRITE=NO
HTTP_PROXY=NO
HTTP_FASTCGI=NO
fi
if [ ".$NGX_PLATFORM" = ".win32" ]; then
NGX_WINE=$WINE
fi
#默认文件路径
NGX_CONF_PATH=${NGX_CONF_PATH:-conf/nginx.conf}
NGX_CONF_PREFIX=`dirname $NGX_CONF_PATH`
NGX_PID_PATH=${NGX_PID_PATH:-logs/nginx.pid}
NGX_LOCK_PATH=${NGX_LOCK_PATH:-logs/nginx.lock}
if [ ".$NGX_ERROR_LOG_PATH" = ".stderr" ]; then
NGX_ERROR_LOG_PATH=
else
NGX_ERROR_LOG_PATH=${NGX_ERROR_LOG_PATH:-logs/error.log}
fi
NGX_HTTP_LOG_PATH=${NGX_HTTP_LOG_PATH:-logs/access.log}
NGX_HTTP_CLIENT_TEMP_PATH=${NGX_HTTP_CLIENT_TEMP_PATH:-client_body_temp}
NGX_HTTP_PROXY_TEMP_PATH=${NGX_HTTP_PROXY_TEMP_PATH:-proxy_temp}
NGX_HTTP_FASTCGI_TEMP_PATH=${NGX_HTTP_FASTCGI_TEMP_PATH:-fastcgi_temp}
NGX_HTTP_UWSGI_TEMP_PATH=${NGX_HTTP_UWSGI_TEMP_PATH:-uwsgi_temp}
NGX_HTTP_SCGI_TEMP_PATH=${NGX_HTTP_SCGI_TEMP_PATH:-scgi_temp}
case ".$NGX_PERL_MODULES" in
./*)
;;
.)
;;
*)
NGX_PERL_MODULES=$NGX_PREFIX/$NGX_PERL_MODULES
;;
esac