Nginx编译参数

configure arguments: 
--with-cc-opt='-g -O2 -fPIE -fstack-protector   	//设置额外的参数将被添加到CFLAGS变量。(FreeBSD或者ubuntu使用)
--param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' 
--with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' 

--prefix=/usr/share/nginx 							//指向安装目录
--conf-path=/etc/nginx/nginx.conf 					//指定配置文件
--http-log-path=/var/log/nginx/access.log 			//指定访问日志
--error-log-path=/var/log/nginx/error.log 			//指定错误日志
--lock-path=/var/lock/nginx.lock 					//指定lock文件
--pid-path=/run/nginx.pid 							//指定pid文件

--http-client-body-temp-path=/var/lib/nginx/body 	//设定http客户端请求临时文件路径
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi 	//设定http fastcgi临时文件路径
--http-proxy-temp-path=/var/lib/nginx/proxy 		//设定http代理临时文件路径
--http-scgi-temp-path=/var/lib/nginx/scgi 			//设定http scgi临时文件路径
--http-uwsgi-temp-path=/var/lib/nginx/uwsgi 		//设定http uwsgi临时文件路径

--with-debug 										//启用debug日志
--with-pcre-jit 									//编译PCRE包含“just-in-time compilation”
--with-ipv6 										//启用ipv6支持
--with-http_ssl_module 								//启用ssl支持
--with-http_stub_status_module 						//获取nginx自上次启动以来的状态
--with-http_realip_module 							//允许从请求标头更改客户端的IP地址值,默认为关
--with-http_auth_request_module 					//实现基于一个子请求的结果的客户端授权。如果该子请求返回的2xx响应代码,所述接入是允许的。如果它返回401或403中,访问被拒绝与相应的错误代码。由子请求返回的任何其他响应代码被认为是一个错误。
--with-http_addition_module 						//作为一个输出过滤器,支持不完全缓冲,分部分响应请求
--with-http_dav_module 								//增加PUT,DELETE,MKCOL:创建集合,COPY和MOVE方法 默认关闭,需编译开启
--with-http_geoip_module 							//使用预编译的MaxMind数据库解析客户端IP地址,得到变量值
--with-http_gunzip_module 							//它为不支持“gzip”编码方法的客户端解压具有“Content-Encoding: gzip”头的响应。
--with-http_gzip_static_module 						//在线实时压缩输出数据流
--with-http_image_filter_module 					//传输JPEG/GIF/PNG 图片的一个过滤器)(默认为不启用。gd库要用到)
--with-http_spdy_module 							//SPDY可以缩短网页的加载时间
--with-http_sub_module 								//允许用一些其他文本替换nginx响应中的一些文本
--with-http_xslt_module 							//过滤转换XML请求
--with-mail 										//启用POP3/IMAP4/SMTP代理模块支持
--with-mail_ssl_module 								//启用ngx_mail_ssl_module支持

启用外部模块支持

--add-module=/build/buildd/nginx-1.8.0/debian/modules/nginx-auth-pam

主要是实现了 NGINX WebDAV 未实现的命令支持,包括:PROPFIND & OPTIONS 对于完整的 WebDAV 支持你需要启用 Nginx 的 WebDAV 模块。

--add-module=/build/buildd/nginx-1.8.0/debian/modules/nginx-dav-ext-module 
		示例配置:
		    location / {
		 
		        dav_methods PUT DELETE MKCOL COPY MOVE;
		        dav_ext_methods PROPFIND OPTIONS;
		 
		        root /var/root/;
		    }

echo模块可以用来输出一些简单的信息(暂未使用)

--add-module=/build/buildd/nginx-1.8.0/debian/modules/nginx-echo 
		示例配置:
			location /hello {
			  echo -n "hello, "
			  echo "world!";
			}

“公平的”Nginx 负载均衡模块,增强了Nginx 提供的round-robin 负载均衡算法,可以跟踪后端服务器的负载来分发请求。(暂未使用)

--add-module=/build/buildd/nginx-1.8.0/debian/modules/nginx-upstream-fair 
		示例配置:
			upstream mongrel {
			    fair;
			    server 127.0.0.1:5000;
			    server 127.0.0.1:5001;
			    server 127.0.0.1:5002;
			}

使用多条匹配规则(暂未使用)

--add-module=/build/buildd/nginx-1.8.0/debian/modules/ngx_http_substitutions_filter_module
		示例配置:
			location / {
			    proxy_pass http://example.com/; #反向代理
			    proxy_set_header Accept-Encoding ""; #防止后端服务器在返回gzip后的内容时模块不起作用
			    subs_filter_types text/html text/css text/xml; #替换html、css、xml内容
			    subs_filter st(d*).example.com $1.example.com ir; #使用正则替换
			    subs_filter a.example.com s.example.com; #使用直接匹配替换
			}
原文地址:https://www.cnblogs.com/xuliangwei/p/6346623.html