nginx安装及编译参数详解教程
nginx安装和编译参数详细解释
解释说明
--sbin-path=
如果在命令行未指定配置文件,那么将会通过这里指定的路径,nginx将会去那里查找他的配置文件
--pid-path=
共享存储器互斥锁文件路径
--group=
为freeBSD4.3+和linux2.6.22+系统启用异步io
-O2 -g -pipe -Wall -Wp,-D\_FORTIFY\_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic'
即为
--prefix=/etc/nginx
--sbin-path=/usr/sbin/nginx
--conf-path=/etc/nginx/nginx.conf
--error-log-path=/var/log/nginx/error.log
--http-log-path=/var/log/nginx/access.log
--pid-path=/var/run/nginx.pid
--lock-path=/var/run/nginx.lock
--http-client-body-temp-path=/var/cache/nginx/client_temp
--http-proxy-temp-path=/var/cache/nginx/proxy_temp
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp
--http-scgi-temp-path=/var/cache/nginx/scgi_temp
--user=nginx
--group=nginx
--with-http_ssl_module
--with-http_realip_module
--with-http_addition_module
--with-http_sub_module
--with-http_dav_module
--with-http_flv_module
--with-http_mp4_module
--with-http_gunzip_module
--with-http_gzip_static_module
--with-http_random_index_module
--with-http_secure_link_module
--with-http_stub_status_module
--with-http_auth_request_module
--with-mail
--with-mail_ssl_module
--with-file-aio --with-ipv6
--with-http_spdy_module
--with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic'
优化编译参数 见下表
选项
说明
--with-cc=
如果想设置一个不在默认path下的c编译器
--with-cpp=
设置c预处理器的相对路径
--with-cc-opt=
指定必要的include文件路径,可能d(-I
--with-ld-opt=
包含连接库的路径和运行路径
-with-cpu-opt=
通过该选项为特定cpu构建nginx
邮件模块独有的配置选项
选项
说明
--without-mail\_pop3\_module
启用mail模块后,单独禁用pop3模块
--without-http
完全禁用http模块,如果只想支持mall,可以使用此项设置
选项
说明
--with-perl\_modules\_path=PATH
设置perl模块路径(perl解析器路径)
--http-client-body-temp-path=PATH
设置客户端请求临时文件路径,如果WebDAV启用,推荐设置该路径为同一文件系统上的目录作为最终的目的地
--http-fastcgi-temp-path=PATH
set path to store http fastcgi temporary files
--with-http\_ssl\_module
如果需要对流量加密.可使用此选项,在urls中开始部分将会是https(需要openssl库)
--with-http\_xslt\_module
--with-http\_geoip\_module
使用该模块,能够设置设置个中变量以便在配置区段中使用
--with-http\_flv\_module
-with-http\_gzip\_static\_module
允许ngx\_http\_gzip\_static\_module模块(mod\_dflate)
这个模块在一个预压缩文件传送到开启Gzip压缩的客户端之前检查是否已经存在以“.gz”结尾的压缩文件,这样可以防止文件被重复压缩
--with-http\_secure\_link\_module
该模块提供一种机制,它会将一个哈希值链接到一个url中,因此,只有那些使用正确的密码能够计算链接
./configure --with-http\_ssl\_module --with-http\_realip\_module --with-http\_geoip\_module --with-http\_stub\_status\_module --with-openssl=${BUILD\_DIR}/openssl-1.0.1c
及web服务器
未完待续