FAQ

Page Discussion Edit History

ChsInstallOptions

(Redirected from NginxChsInstallOptions)

Contents

[edit] 缂栬瘧閫夐」

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> - 鍦╪ginx.conf涓病鏈夋寚瀹歱id鎸囦护鐨勬儏鍐典笅锛岄粯璁ょ殑nginx.pid鐨勮矾寰勩傚鏋滄病鏈夋寚瀹氾紝榛樿涓 <prefix>/logs/nginx.pid銆

--lock-path=<path> - nginx.lock鏂囦欢鐨勮矾寰勩

--error-log-path=<path> - 鍦╪ginx.conf涓病鏈夋寚瀹歟rror_log鎸囦护鐨勬儏鍐典笅锛岄粯璁ょ殑閿欒鏃ュ織鐨勮矾寰勩傚鏋滄病鏈夋寚瀹氾紝榛樿涓 <prefix>/logs/error.log銆

--http-log-path=<path> - 鍦╪ginx.conf涓病鏈夋寚瀹歛ccess_log鎸囦护鐨勬儏鍐典笅锛岄粯璁ょ殑璁块棶鏃ュ織鐨勮矾寰勩傚鏋滄病鏈夋寚瀹氾紝榛樿涓 <prefix>/logs/access.log銆

--user=<user> - 鍦╪ginx.conf涓病鏈夋寚瀹歶ser鎸囦护鐨勬儏鍐典笅锛岄粯璁ょ殑nginx浣跨敤鐨勭敤鎴枫傚鏋滄病鏈夋寚瀹氾紝榛樿涓 nobody銆

--group=<group> - 鍦╪ginx.conf涓病鏈夋寚瀹歶ser鎸囦护鐨勬儏鍐典笅锛岄粯璁ょ殑nginx浣跨敤鐨勭粍銆傚鏋滄病鏈夋寚瀹氾紝榛樿涓 nobody銆

--builddir=DIR - 鎸囧畾缂栬瘧鐨勭洰褰

--with-rtsig_module - 鍚敤 rtsig 妯″潡

--with-select_module --without-select_module - Whether or not to enable the select module. This module is enabled by default if a more suitable method such as kqueue, epoll, rtsig or /dev/poll is not discovered by configure.

//鍏佽鎴栦笉鍏佽寮鍚疭ELECT妯″紡锛屽鏋 configure 娌℃湁鎵惧埌鏇村悎閫傜殑妯″紡锛屾瘮濡傦細kqueue(sun os),epoll (linux kenel 2.6+), rtsig(瀹炴椂淇″彿)鎴栬/dev/poll(涓绉嶇被浼約elect鐨勬ā寮忥紝搴曞眰瀹炵幇涓嶴ELECT鍩烘湰鐩 鍚岋紝閮芥槸閲囩敤杞鏂规硶) SELECT妯″紡灏嗘槸榛樿瀹夎妯″紡

--with-poll_module --without-poll_module - Whether or not to enable the poll module. This module is enabled by default if a more suitable method such as kqueue, epoll, rtsig or /dev/poll is not discovered by configure.

--with-http_ssl_module - Enable ngx_http_ssl_module. Enables SSL support and the ability to handle HTTPS requests. Requires OpenSSL. On Debian, this is libssl-dev.

//寮鍚疕TTP SSL妯″潡锛屼娇NGINX鍙互鏀寔HTTPS璇锋眰銆傝繖涓ā鍧楅渶瑕佸凡缁忓畨瑁呬簡OPENSSL锛屽湪DEBIAN涓婃槸libssl-dev

--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 - 鍚敤 "server status" 椤

--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 - Set path to the http access log

--http-client-body-temp-path=PATH - Set path to the http client request body temporary files

--http-proxy-temp-path=PATH - Set path to the http proxy temporary files

--http-fastcgi-temp-path=PATH - Set path to the http fastcgi temporary files

--without-http - 绂佺敤 HTTP server

--with-mail - 鍚敤 IMAP4/POP3/SMTP 浠g悊妯″潡

--with-mail_ssl_module - 鍚敤 ngx_mail_ssl_module

--with-cc=PATH - 鎸囧畾 C 缂栬瘧鍣ㄧ殑璺緞

--with-cpp=PATH - 鎸囧畾 C 棰勫鐞嗗櫒鐨勮矾寰

--with-cc-opt=OPTIONS - Additional parameters which will be added to the variable CFLAGS. With the use of the system library PCRE in FreeBSD, it is necessary to indicate --with-cc-opt="-I /usr/local/include". If we are using select() and it is necessary to increase the number of file descriptors, then this also can be assigned here: --with-cc-opt="-D FD_SETSIZE=2048".

--with-ld-opt=OPTIONS - Additional parameters passed to the linker. With the use of the system library PCRE in FreeBSD, it is necessary to indicate --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 搴撶殑浣跨敤銆傚悓鏃朵篃浼氱姝 HTTP rewrite 妯″潡銆傚湪 "location" 閰嶇疆鎸囦护涓殑姝e垯琛ㄨ揪寮忎篃闇瑕 PCRE 銆

--with-pcre=DIR - 鎸囧畾 PCRE 搴撶殑婧愪唬鐮佺殑璺緞銆

--with-pcre-opt=OPTIONS - Set additional options for PCRE building.

--with-md5=DIR - Set path to md5 library sources.

--with-md5-opt=OPTIONS - Set additional options for md5 building.

--with-md5-asm - Use md5 assembler sources.

--with-sha1=DIR - Set path to sha1 library sources.

--with-sha1-opt=OPTIONS - Set additional options for sha1 building.

--with-sha1-asm - Use sha1 assembler sources.

--with-zlib=DIR - Set path to zlib library sources.

--with-zlib-opt=OPTIONS - Set additional options for zlib building.

--with-zlib-asm=CPU - Use zlib assembler sources optimized for specified CPU, valid values are: pentium, pentiumpro

--with-openssl=DIR - Set path to OpenSSL library sources

--with-openssl-opt=OPTIONS - Set additional options for OpenSSL building

--with-debug - 鍚敤璋冭瘯鏃ュ織

--add-module=PATH - Add in a third-party module found in directory PATH

鍦ㄤ笉鍚岀増鏈棿锛岄夐」鍙兘浼氭湁浜涜鍙樺寲锛岃鎬绘槸浣跨敤 ./configure --help 鍛戒护鏉ユ鏌ヤ竴涓嬪綋鍓嶇殑閫夐」鍒楄〃銆

[edit] 绀轰緥

[edit] 绀轰緥 1

杩欏彧鏄竴琛岋紒

./configure \
  --sbin-path=/usr/local/nginx/nginx \
  --conf-path=/usr/local/nginx/nginx.conf \
  --pid-path=/usr/local/nginx/nginx.pid \
  --with-http_ssl_module \
  --with-pcre=../pcre-4.4 \
  --with-zlib=../zlib-1.1.3

[edit] 绀轰緥 2

Debian Lenny 榛樿璁剧疆

./configure \
  --conf-path=/etc/nginx/nginx.conf \
  --error-log-path=/var/log/nginx/error.log \
  --pid-path=/var/run/nginx.pid \
  --lock-path=/var/lock/nginx.lock \
  --http-log-path=/var/log/nginx/access.log \
  --with-http_dav_module \
  --http-client-body-temp-path=/var/lib/nginx/body \
  --with-http_ssl_module \
  --http-proxy-temp-path=/var/lib/nginx/proxy \
  --with-http_stub_status_module \
  --http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
  --with-debug \
  --with-http_flv_module 

[edit] 绀轰緥 3

./configure \
  --prefix=/usr \
  --conf-path=/etc/nginx/nginx.conf \
  --http-log-path=/var/log/nginx/access_log \
  --error-log-path=/var/log/nginx/error_log \
  --pid-path=/var/run/nginx.pid \
  --http-client-body-temp-path=/var/tmp/nginx/client \
  --http-proxy-temp-path=/var/tmp/nginx/proxy \
  --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi \
  --with-md5-asm --with-md5=/usr/include \
  --with-sha1-asm \
  --with-sha1=/usr/include \
  --with-http_realip_module \
  --with-http_ssl_module \
  --with-http_perl_module \
  --with-http_stub_status_module

[edit] 绀轰緥 4

鍦ㄨ鏈 libgcrypt11-dev, libpcre3-dev and libssl-dev 鐨 Ubuntu/debian 涓 (閫夋嫨 --with-md5 鎴栬 --with-sha1, 涓嶈鍚屾椂閫夋嫨涓や釜; 鍦 debian 鍜 ubuntu 涓, 閫氬父琚寚瀹氬埌 /usr/lib)

  ./configure --with-openssl=/usr/lib/ssl/ --with-md5=/usr/lib

[edit] 绀轰緥 5

鐢ㄤ簬 RedHat 绯诲彂琛岀増 (RHEL, CentOS, Fedora). 鏈淮鍩虹珯鐐圭殑鏈嶅姟鍣ㄥ氨鏄互姝ら夐」缂栬瘧.

棣栧厛瀹夎闇姹傚寘:

yum install gcc openssl-devel pcre-devel zlib-devel

閰嶇疆:

./configure 
  --prefix=/usr \
  --sbin-path=/usr/sbin/nginx \
  --conf-path=/etc/nginx/nginx.conf \
  --error-log-path=/var/log/nginx/error.log \
  --pid-path=/var/run/nginx/nginx.pid  \
  --lock-path=/var/lock/nginx.lock \
  --user=nginx \
  --group=nginx \
  --with-http_ssl_module \
  --with-http_flv_module \
  --with-http_gzip_static_module \
  --http-log-path=/var/log/nginx/access.log \
  --http-client-body-temp-path=/var/tmp/nginx/client/ \
  --http-proxy-temp-path=/var/tmp/nginx/proxy/ \
  --http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ 

鏈鍚庣紪璇戝苟瀹夎

make && make install