nginx配置之一堆without
现在装nginx,一般是装tengine。现最新版是基于nginx1.2.9的tengine-1.5.2,下文的参数是tengine-1.5.2的,和原版nginx应该大同小异。
我目前的安装一般是:./configure --prefix=/usr/local/webserver/tengine --without-http_ssl_module安装完后,可通过nginx -l 查看已安装的模块,好多,于是看了下configure里的without参数。./configure --help | grep without- --without-select_module disable select module --without-poll_module disable poll module --without-procs disable procs module --without-syslog disable syslog logging --without-dso disable dso module load --without-http_charset_module disable ngx_http_charset_filter_module --without-http_gzip_module disable ngx_http_gzip_filter_module --without-http_ssi_module disable ngx_http_ssi_module --without-http_ssl_module disable ngx_http_ssl_module --without-http_userid_module disable ngx_http_userid_filter_module --without-http_footer_filter_module --without-http_trim_filter_module disable ngx_http_trim_filter_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 --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_check_module --without-http_upstream_least_conn_module --without-http_upstream_session_sticky_module --without-http_upstream_keepalive_module --without-http_upstream_ip_hash_module --without-http_upstream_consistent_hash_module --without-http_user_agent_module disable ngx_http_user_agent_module --without-http_stub_status_module disable ngx_http_stub_status_module --without-http disable HTTP server --without-http-cache disable HTTP cache --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 --without-pcre disable PCRE library usage好夸张啊,这么多!也就是说如果你不一一without的话,你会装这么多模块,而实际使用到的也许就几个。有一个场景,比如图片服务器,我想上面的除了不要加--without-http,其它几乎所有模块都可以without掉!分别来表述下,好多模块不知道是干嘛的,谷歌百度了好久才大致明白。--without-select_module --without-poll_module一般用epoll模式了,很少用这两个了吧?--without-dso关闭动态加载模块的功能,这是tengine特有的功能--without-http_charset_module定义文件编码格式,不是非常明白,MS可关闭--without-http_gzip_module这个web服务器基本上都要的,对css,js等gzip压缩用--without-http_ssi_module简单说允许html可以包含文件,一般来说也不用--without-http_ssl_module要建ssl站点吗?一般不需要吧。--without-http_userid_module在无法使用cookies的地方实现用户标识,用于链接中自动增加sessionID等,MS可关闭--without-http_footer_filter_module在请求的响应末尾输出一段内容。输出内容可配置,并支持内嵌变量。这是tengine特有的功能--without-http_trim_filter_module该模块用于删除 html , 内嵌 javascript 和 css 中的注释以及重复的空白符。这是tengine特有的功能--without-http_access_module访问控制模块,一般需要-without-http_auth_basic_module一种简单的验证用户的方式--without-http_autoindex_module目录下没默认文件时,会把这个目录下的文件都列出,一般不需要--without-http_geo_module据说是根据来访IP判断用户访问,可实现类似智能解析的功能,一般不需要--without-http_map_module据说是条件赋值模块,用于复杂条件的判断, 可关闭--without-http_split_clients_moduleSplits clients based on some conditions--without-http_referer_module来源referer,一般都需要--without-http_rewrite_module重写rewrite,一般都需要--without-http_proxy_module代理服务,其实一般也不需要--without-http_fastcgi_module一般用来运行php,一般都需要--without-http_uwsgi_moduleuWSGI protocol支持,一般不需要--without-http_scgi_moduleSCGI protocol 支持,一般不需要--without-http_memcached_modulememcached缓存模块, 通常用于服务器间共享数据, 方便但据说效率不高,一般不需要 --without-http_limit_conn_module --without-http_limit_req_module限制连接数,请求数等--without-http_empty_gif_module强制返回一个在内存中的1*1的空GIF图, 通常用于访问统计/日志记录等, 可关闭--without-http_browser_module根据访问者浏览器进行基本判断, 可关闭 --without-http_upstream等对upstream进行一些控制--without-http_user_agent_module根据user_agent做些判断,一般不需要 --without-http_stub_status_module获取Nginx自上次启动以来的工作状态,对于监控web请求数据有点作用 --without-http disable HTTP server这个,不要http服务,那装nginx干嘛? --without-http-cache disable HTTP cache没明白什么作用 --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邮件相关的,一般程序中处理,不需要 --without-pcre pcre支持,一般不需要 nginx官方对模块有一些较详细的介绍,可以参考下:相关日志