Nginx Configure 配置详解

haoxun0 2011-08-23

Nginx使用Unix下常用的'./configure&&make&&makeinstall'过程来编译安装。

configure脚本确定系统所具有一些特性,特别是nginx用来处理连接的方法。然后,它创建Makefile文件。

configure支持下面的选项:

--prefix=<path>-Nginx安装路径。如果没有指定,默认为/usr/local/nginx。

--sbin-path=<path>-Nginx可执行文件安装路径。只能安装时指定,如果没有指定,默认为<prefix>/sbin/nginx。

--conf-path=<path>-在没有给定-c选项下默认的nginx.conf的路径。如果没有指定,默认为<prefix>/conf/nginx.conf。

--pid-path=<path>-在nginx.conf中没有指定pid指令的情况下,默认的nginx.pid的路径。如果没有指定,默认为<prefix>/logs/nginx.pid。

--lock-path=<path>-nginx.lock文件的路径。

--error-log-path=<path>-在nginx.conf中没有指定error_log指令的情况下,默认的错误日志的路径。如果没有指定,默认为<prefix>/logs/error.log。

--http-log-path=<path>-在nginx.conf中没有指定access_log指令的情况下,默认的访问日志的路径。如果没有指定,默认为<prefix>/logs/access.log。

--user=<user>-在nginx.conf中没有指定user指令的情况下,默认的nginx使用的用户。如果没有指定,默认为nobody。

--group=<group>-在nginx.conf中没有指定user指令的情况下,默认的nginx使用的组。如果没有指定,默认为nobody。

--builddir=DIR-指定编译的目录

--with-rtsig_module-启用rtsig模块

--with-select_module--without-select_module-Whetherornottoenabletheselectmodule.Thismoduleisenabledbydefaultifamoresuitablemethodsuchaskqueue,epoll,rtsigor/dev/pollisnotdiscoveredbyconfigure.

//允许或不允许开启SELECT模式,如果configure没有找到更合适的模式,比如:kqueue(sunos),epoll(linuxkenel2.6+),rtsig(实时信号)或者/dev/poll(一种类似select的模式,底层实现与SELECT基本相同,都是采用轮训方法)SELECT模式将是默认安装模式

--with-poll_module--without-poll_module-Whetherornottoenablethepollmodule.Thismoduleisenabledbydefaultifamoresuitablemethodsuchaskqueue,epoll,rtsigor/dev/pollisnotdiscoveredbyconfigure.

--with-http_ssl_module-Enablengx_http_ssl_module.EnablesSSLsupportandtheabilitytohandleHTTPSrequests.RequiresOpenSSL.OnDebian,thisislibssl-dev.

//开启HTTPSSL模块,使NGINX可以支持HTTPS请求。这个模块需要已经安装了OPENSSL,在DEBIAN上是libssl

--with-http_realip_module-启用ngx_http_realip_module

--with-http_addition_module-启用ngx_http_addition_module

--with-http_sub_module-启用ngx_http_sub_module

--with-http_dav_module-启用ngx_http_dav_module

--with-http_flv_module-启用ngx_http_flv_module

--with-http_stub_status_module-启用"serverstatus"页

--without-http_charset_module-禁用ngx_http_charset_module

--without-http_gzip_module-禁用ngx_http_gzip_module.如果启用,需要zlib。

--without-http_ssi_module-禁用ngx_http_ssi_module

--without-http_userid_module-禁用ngx_http_userid_module

--without-http_access_module-禁用ngx_http_access_module

--without-http_auth_basic_module-禁用ngx_http_auth_basic_module

--without-http_autoindex_module-禁用ngx_http_autoindex_module

--without-http_geo_module-禁用ngx_http_geo_module

--without-http_map_module-禁用ngx_http_map_module

--without-http_referer_module-禁用ngx_http_referer_module

--without-http_rewrite_module-禁用ngx_http_rewrite_module.如果启用需要PCRE。

--without-http_proxy_module-禁用ngx_http_proxy_module

--without-http_fastcgi_module-禁用ngx_http_fastcgi_module

--without-http_memcached_module-禁用ngx_http_memcached_module

--without-http_limit_zone_module-禁用ngx_http_limit_zone_module

--without-http_empty_gif_module-禁用ngx_http_empty_gif_module

--without-http_browser_module-禁用ngx_http_browser_module

--without-http_upstream_ip_hash_module-禁用ngx_http_upstream_ip_hash_module

--with-http_perl_module-启用ngx_http_perl_module

--with-perl_modules_path=PATH-指定perl模块的路径

--with-perl=PATH-指定perl执行文件的路径

--http-log-path=PATH-Setpathtothehttpaccesslog

--http-client-body-temp-path=PATH-Setpathtothehttpclientrequestbodytemporaryfiles

--http-proxy-temp-path=PATH-Setpathtothehttpproxytemporaryfiles

--http-fastcgi-temp-path=PATH-Setpathtothehttpfastcgitemporaryfiles

--without-http-禁用HTTPserver

--with-mail-启用IMAP4/POP3/SMTP代理模块

--with-mail_ssl_module-启用ngx_mail_ssl_module

--with-cc=PATH-指定C编译器的路径

--with-cpp=PATH-指定C预处理器的路径

--with-cc-opt=OPTIONS-AdditionalparameterswhichwillbeaddedtothevariableCFLAGS.WiththeuseofthesystemlibraryPCREinFreeBSD,itisnecessarytoindicate--with-cc-opt="-I/usr/local/include".Ifweareusingselect()anditisnecessarytoincreasethenumberoffiledescriptors,thenthisalsocanbeassignedhere:--with-cc-opt="-DFD_SETSIZE=2048".

--with-ld-opt=OPTIONS-Additionalparameterspassedtothelinker.WiththeuseofthesystemlibraryPCREinFreeBSD,itisnecessarytoindicate--with-ld-opt="-L/usr/local/lib".

--with-cpu-opt=CPU-为特定的CPU编译,有效的值包括:pentium,pentiumpro,pentium3,pentium4,athlon,opteron,amd64,sparc32,sparc64,ppc64

--without-pcre-禁止PCRE库的使用。同时也会禁止HTTPrewrite模块。在"location"配置指令中的正则表达式也需要PCRE。

--with-pcre=DIR-指定PCRE库的源代码的路径。

--with-pcre-opt=OPTIONS-SetadditionaloptionsforPCREbuilding.

--with-md5=DIR-Setpathtomd5librarysources.

--with-md5-opt=OPTIONS-Setadditionaloptionsformd5building.

--with-md5-asm-Usemd5assemblersources.

--with-sha1=DIR-Setpathtosha1librarysources.

--with-sha1-opt=OPTIONS-Setadditionaloptionsforsha1building.

--with-sha1-asm-Usesha1assemblersources.

--with-zlib=DIR-Setpathtozliblibrarysources.

--with-zlib-opt=OPTIONS-Setadditionaloptionsforzlibbuilding.

--with-zlib-asm=CPU-UsezlibassemblersourcesoptimizedforspecifiedCPU,validvaluesare:pentium,pentiumpro

--with-openssl=DIR-SetpathtoOpenSSLlibrarysources

--with-openssl-opt=OPTIONS-SetadditionaloptionsforOpenSSLbuilding

--with-debug-启用调试日志

--add-module=PATH-Addinathird-partymodulefoundindirectoryPATH

在不同版本间,选项可能会有些许变化,请总是使用./configure--help命令来检查一下当前的选项列表。

相关推荐

lwplvx / 0评论 2020-11-22
岁月如歌 / 0评论 2020-07-21