设为首页 收藏本站
查看: 1390|回复: 0

[经验分享] nginx编译安装和常规配置

[复制链接]

尚未签到

发表于 2018-11-10 07:47:14 | 显示全部楼层 |阅读模式
nginx编译安装和常规配置
  Nginx 是一个高性能的 HTTP 和 反向代理服务器,也是一个 IMAP/POP3/SMTP 代理服务器。Nginx 编译安装比较简单,难点在于配置。
  Nginx 可以在大多数 Unix like OS 上编译运行,并有 Windows 移植版。目前 Nginx 的1.0.0稳定版已发布,开发版本为0.9.x,稳定版为 0.8.x,历史稳定版为 0.7.x,建议使用 0.8系列作为生产版本。 2011年6月1日,nginx 1.0.4发布。
  优点:
  在高连接并发的情况下,Nginx是Apache服务器不错的替代品:Nginx在美国是做虚拟主机生意的老板们经常选择的软件平台之一。能够支持高达 50,000 个并发连接数的响应,感谢Nginx为我们选择了 epoll and kqueue作为开发模型。
  Nginx作为负载均衡服务器:Nginx 既可以在内部直接支持 Rails 和 PHP 程序对外进行服务,也可以支持作为 HTTP代理服务器对外进行服务。Nginx采用C进行编写,不论是系统资源开销还是CPU使用效率都比 Perlbal 要好很多。
  作为邮件代理服务器:Nginx 同时也是一个非常优秀的邮件代理服务器(最早开发这个产品的目的之一也是作为邮件代理服务器),Last. fm 描述了成功并且美妙的使用经验。
  Nginx 是一个安装非常的简单,配置文件非常简洁(还能够支持perl语法),Bugs非常少的服务器:Nginx 启动特别容易,并且几乎可以做到7*24不间断运行,即使运行数个月也不需要重新启动。你还能够不间断服务的情况下进行软件版本的升级。
  一、编译安装nginx(官方文档http://wiki.nginx.org/Main)
  1.模块依赖性:
  gzip 模块需要 zlib 库
  rewrite 模块需要 pcre 库
  ssl 功能需要 openssl 库
  #yum install gcc openssl-devel pcre-devel zlib-devel(gcc编译环境)
  2.nginx编译
  先添加nginx用户和用户组
  # groupadd nginx
  # useradd -g nginx -s /bin/false -M nginx
  解压源码包,这里采用最新的源码包1.0.4
  #tar -zxf nginx-1.0.4.tar.gz
  #cd nginx-1.0.4
  #./configure \
  --prefix=/usr \
  --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/nginx.pid  \
  --lock-path=/var/lock/nginx.lock \
  --user=nginx \
  --group=nginx \
  --with-http_ssl_module \
  --with-http_flv_module \
  --with-http_stub_status_module \
  --with-http_gzip_static_module \
  --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
  #makedir -p /var/log/nginx(编译时不会创建日志目录,需手工创建)
  创建启动脚本/etc/init.d/nginx(也可以从官方文档下载
  http://wiki.nginx.org/RedHatNginxInitScript)
  亦可自己创建
  #!/bin/sh
  #
  # nginx - this script starts and stops the nginx daemon
  #
  # chkconfig:   - 85 15
  # description:  Nginx is an HTTP(S) server, HTTP(S) reverse \
  #               proxy and IMAP/POP3 proxy server
  # processname: nginx
  # config:      /etc/nginx/nginx.conf
  # config:      /etc/sysconfig/nginx
  # pidfile:     /var/run/nginx.pid
  # Source function library.
  . /etc/rc.d/init.d/functions
  # Source networking configuration.
  . /etc/sysconfig/network
  # Check that networking is up.
  [ "$NETWORKING" = "no" ] && exit 0
  nginx="/usr/sbin/nginx"
  prog=$(basename $nginx)
  NGINX_CONF_FILE="/etc/nginx/nginx.conf"
  [ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx
  lockfile=/var/lock/subsys/nginx
  make_dirs() {
  # make required directories
  user=`nginx -V 2>&1 | grep "configure arguments:" | sed 's/[^*]*--user=\([^
  ]*\).*/\1/g' -`
  options=`$nginx -V 2>&1 | grep 'configure arguments:'`
  for opt in $options; do
  if [ `echo $opt | grep '.*-temp-path'` ]; then
  value=`echo $opt | cut -d "=" -f 2`
  if [ ! -d "$value" ]; then
  # echo "creating" $value
  mkdir -p $value && chown -R $user $value
  fi
  fi
  done
  }
  start() {
  [ -x $nginx ] || exit 5
  [ -f $NGINX_CONF_FILE ] || exit 6
  make_dirs
  echo -n $"Starting $prog: "
  daemon $nginx -c $NGINX_CONF_FILE
  retval=$?
  echo
  [ $retval -eq 0 ] && touch $lockfile
  return $retval
  }
  stop() {
  echo -n $"Stopping $prog: "
  killproc $prog -QUIT
  retval=$?
  echo
  [ $retval -eq 0 ] && rm -f $lockfile
  return $retval
  }
  restart() {
  configtest || return $?
  stop
  sleep 1
  start
  }
  reload() {
  configtest || return $?
  echo -n $"Reloading $prog: "
  killproc $nginx -HUP
  RETVAL=$?
  echo
  }
  force_reload() {
  restart
  }
  configtest() {
  $nginx -t -c $NGINX_CONF_FILE
  }
  rh_status() {
  status $prog
  }
  rh_status_q() {
  rh_status >/dev/null 2>&1
  }
  case "$1" in
  start)
  rh_status_q && exit 0
  $1
  ;;
  stop)
  rh_status_q || exit 0
  $1
  ;;
  restart|configtest)
  $1
  ;;
  reload)
  rh_status_q || exit 7
  $1
  ;;
  force-reload)
  force_reload
  ;;
  status)
  rh_status
  ;;
  condrestart|try-restart)
  rh_status_q || exit 0
  ;;
  *)
  echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|
  reload|force-reload|configtest}"
  exit 2
  esac
  #chkconfig --add nginx
  #service ngnix start
  #chkconfig nginx on
  可以访问一下页面测试一下呵呵!
  http://yourIP
  二、Nginx虚拟主机配置
  1.基于IP的虚拟主机
  在eth0上添加两块网卡别名,分别为192.168.0.11和192.168.0.12
  #ifconfig eth0:1 192.168.0.11/24
  #ifconfig eth0:2 192.168.0.12/24
  这是检测一下,应该在eth0上有两个别名(ip addr | grep eth0)
  配置nginx主配置文件
  http {
  server {
  listen          192.168.0.11:80;
  server_name     192.168.0.11;
  access_log      logs/server1.access.log main;
  location / {
  index index.html;
  root  /var/www/server1;
  }
  }
  server {
  listen          192.168.0.12:80;
  server_name     192.168.0.12;
  access_log      logs/server2.access.log main;
  location / {
  index index.html;
  root  /var/www/server2;
  }
  }
  }
  接下来建立网页文件,在/var/www/server1和/var/www/server2分别编辑一些网页文
  件,尽量不同。
  平滑启动nginx服务

  #service nginx>  测试一下
  2.配置基于域名的虚拟主机
  2.配置基于域名的虚拟主机
  基于域名的虚拟主机是最常见的一种虚拟主机。只需配置你的DNS服务器,
  经每个主机名映射到正确的IP地址,然后配置Nginx服务器,令其识别不同的主机
  名就可以了。这种虚拟主机技术,使很多虚拟主机可以共享同一个IP地址,有效
  解决了IP地址不足的问题。所以,如果没有特殊要求是你必须用一个基于IP的虚
  拟主机,最好使用基于域名的虚拟主机。
  接下来配置基于域名的虚拟主机。在以下的实例中,配置三个虚拟主机,
  第一个虚拟主机对应的域名是aaa.domain.com,第二个虚拟主机对应的虚拟主机
  的域名是bbb.other.com,第三个虚拟主机对应域名www.domain.com、domain.com,
  以及除了aaa.domain.com之外的所有*.domain.com二级域名的访问都有它来处理
  。每个虚拟主机的网页文件分别存放在了不同的目录中,每个虚拟主机使用了不
  同的的日志文件来记录访问日志。
  代码:
  http{
  #第一个虚拟主机
  server
  {
  listen 80;
  server_name aaa.domain.com;
  access_log       logs/aaa.domain.com.access.log
  combined;
  locaton /
  {
  index index.html index.htm;
  root  /data0/htdocs/aaa.domain.com;
  }
  }
  #第二个虚拟主机
  server
  {
  listen 80;
  server_name bbb.domain.com;
  access_log       logs/bbb.domain.com.access.log
  combined;
  locaton /
  {
  index index.html index.htm;
  root  /data0/htdocs/bbb.domain.com;
  }
  }
  #第三个虚拟主机
  server
  {
  listen 80;
  server_name www.domain.com domain.com *.domain.com;
  access_log       logs/www.domain.com.access.log
  combined;
  locaton /
  {
  index index.html index.htm;
  root  /data0/htdocs/www.domain.com;
  }
  }
  三 、Nginx与PHP(Fastcgi)的安装、配置
  架构 Linux+Nginx+Mysql+PHP
  补充:什么是CGI
  CGI全称是“公共网关接口”(Common Gateway Interface),HTTP服务器与你
  的或其它机器上的程序进行“交谈”的一种工具,其程序须运行在网络服务器上
  。
  CGI可以用任何一种语言编写,只要这种语言具有标准输入、输出和环境变量
  。如php,perl,tcl等
  什么是FastCGI
  FastCGI像是一个常驻(long-live)型的CGI,它可以一直执行着,只要激活后
  ,不会每次都要花费时间去fork一次(这是CGI最为人诟病的fork-and-execute 模
  式)。它还支持分布式的运算, 即 FastCGI 程序可以在网站服务器以外的主机上
  执行并且接受来自其它网站服务器来的请求。
  FastCGI是语言无关的、可伸缩架构的CGI开放扩展,其主要行为是将CGI解释
  器进程保持在内存中并因此获得较高的性能。众所周知,CGI解释器的反复加载是
  CGI性能低下的主要原因,如果CGI解释器保持在内存中并接受FastCGI进程管理器
  调度,则可以提供良好的性能、伸缩性、Fail- Over特性等等。
  FastCGI与CGI特点
  1、如CGI,FastCGI也具有语言无关性.
  2、如CGI, FastCGI在进程中的应用程序,独立于核心web服务器运行,提供了
  一个比API更安全的环境。(APIs把应用程序的代码与核心的web服务器链接在一起
  ,这意味着在一个错误的API的应用程序可能会损坏其他应用程序或核心服务器;
  恶意的API的应用程序代码甚至可以窃取另一个应用程序或核心服务器的密钥。)
  3、FastCGI技术目前支持语言有:C/C++、Java、Perl、Tcl、Python、
  SmallTalk、Ruby等。相关模块在Apache, ISS, Lighttpd等流行的服务器上也是
  可用的。
  4、如CGI,FastCGI的不依赖于任何Web服务器的内部架构,因此即使服务器
  技术的变化, FastCGI依然稳定不变。
  FastCGI的工作原理
  1、Web Server启动时载入FastCGI进程管理器(IIS ISAPI或Apache Module)
  2、FastCGI进程管理器自身初始化,启动多个CGI解释器进程(可见多个php-
  cgi)并等待来自Web Server的连接。
  3、当客户端请求到达Web Server时,FastCGI进程管理器选择并连接到一个
  CGI解释器。Web server将CGI环境变量和标准输入发送到FastCGI子进程php-cgi
  。
  4、FastCGI子进程完成处理后将标准输出和错误信息从同一连接返回Web
  Server。当FastCGI子进程关闭连接时,请求便告处理完成。FastCGI子进程接着
  等待并处理来自FastCGI进程管理器(运行在Web Server中)的下一个连接。 在CGI
  模式中,php-cgi在此便退出了。
  在上述情况中,你可以想象CGI通常有多慢。每一个Web请求PHP都必须重新解
  析php.ini、重新载入全部扩展并重初始化全部数据结构。使用FastCGI,所有这
  些都只在进程启动时发生一次。一个额外的好处是,持续数据库连接(Persistent
  database connection)可以工作。
  FastCGI的不足
  因为是多进程,所以比CGI多线程消耗更多的服务器内存,PHP-CGI解释器每
  进程消耗7至25兆内存,将这个数字乘以50或100就是很大的内存数。
  Nginx 0.8.46+PHP 5.2.14(FastCGI)服务器在3万并发连接下,开启的10个
  Nginx进程消耗150M内存(15M*10=150M),开启的64个php-cgi进程消耗1280M内
  存(20M*64=1280M),加上系统自身消耗的内存,总共消耗不到2GB内存。如果服
  务器内存较小,完全可以只开启25个php-cgi进程,这样php-cgi消耗的总内存数
  才500M。
  编译配置
  for PHP 5.3.3
  PHP-FPM is now included in PHP core as of PHP 5.3.3.   Make sure
  libxml2 (and libxml2-devel) is installed, and libevent version is
  1.4.12 or later, and libiconv.
  libevent
  The libevent API provides a mechanism to execute a callback function
  when a specific event occurs on a file descriptor or after a timeout
  has been reached. Furthermore, libevent also support callbacks due to
  signals or regular timeouts.
  libevent is meant to replace the event loop found in event driven
  network servers. An application just needs to call event_dispatch() and
  then add or remove events dynamically without having to change the
  event loop.
  Currently, libevent supports /dev/poll, kqueue(2), event ports, select
  (2), poll(2) and epoll(4). The internal event mechanism is completely
  independent of the exposed event API, and a simple update of libevent
  can provide new functionality without having to redesign the
  applications. As a result, Libevent allows for portable application
  development and provides the most scalable event notification mechanism
  available on an operating system. Libevent can also be used for multi-
  threaded applications.
  # tar zxvf libevent-1.4.14b-stable.tar.gz
  # cd libevent-1.4.14b-stable
  # ./configure
  # make && make install
  # make verify
  libiconv
  For historical reasons, international text is often encoded using a
  language or country dependent character encoding. With the advent of
  the internet and the frequent exchange of text across countries - even
  the viewing of a web page from a foreign country is a "text exchange"
  in this context -, conversions between these encodings have become
  important. They have also become a problem, because many characters
  which are present in one encoding are absent in many other encodings.
  To solve this mess, the Unicode encoding has been created. It is a
  super-encoding of all others and is therefore the default encoding for
  new text formats like XML.
  Still, many computers still operate in locale with a traditional
  (limited) character encoding. Some programs, like mailers and web
  browsers, must be able to convert between a given text encoding and the
  user's encoding. Other programs internally store strings in Unicode, to
  facilitate internal processing, and need to convert between internal
  string representation (Unicode) and external string representation (a
  traditional encoding) when they are doing I/O. GNU libiconv is a
  conversion library for both kinds of applications.
  # tar zxvf libiconv-1.13.1.tar.gz
  # cd libiconv-1.13.1
  # ./configure
  # make && make install
  libmcrypt
  MCrypt is a replacement for the old crypt() package and crypt(1)
  command, with extensions. It allows developers to use a wide range of
  encryption functions, without making drastic changes to their code. It
  allows users to encrypt files or data streams without having to be
  cryptographers. Above all, it allows you to have some really neat code
  on your machine. :)
  The companion to MCrypt is Libmcrypt, which contains the actual
  encryption functions themselves, and provides a standardized mechanism
  for accessing them.
  # tar zxvf libmcrypt-2.5.8.tar.gz
  # cd libmcrypt-2.5.8
  # ./configure
  # make && make install
  # ldconfig -v
  # cd libltdl
  # ./configure --with-gmetad --enable-gexec
  # make && make install
  mhash
  Mhash is a free (under GNU Lesser GPL) library which provides a uniform
  interface to a large number of hash algorithms. These algorithms can be
  used to compute checksums, message digests, and other signatures.
  # tar jxvf mhash-0.9.9.9.tar.bz2
  # cd mhash-0.9.9.9
  # ./configure
  # make && make install
  # ln -sv /usr/local/lib/libmcrypt* /usr/lib/
  # ln -sv /usr/local/lib/libmhash.* /usr/lib/
  mysql-5.5安装前面的博客已用不再赘述
  php-5.3.6
  # tar jxvf php-5.3.6.tar.bz2
  # cd jxvf php-5.3.6
  # ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --
  with-openssl --enable-fpm --with-
  mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-
  freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-
  dir=/usr --enable-xml --with-iconv-dir=/usr/local
  # make ZEND_EXTRA_LIBS='-liconv'
  # make install
  # cp php.ini-production /usr/local/php/etc/php.ini
  启动fastcgi:
  # cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-
  fpm.conf
  # vim /usr/local/php/etc/php-fpm.conf
  启用如下选项:
  pm.start_servers = 20
  pm.min_spare_servers = 5
  pm.max_spare_servers = 35
  # /usr/local/php/sbin/php-fpm
  接下来整合nginx和php5
  编辑/etc/nginx/nginx.conf,启用如下选项:
  location ~ \.php$ {
  root           html;
  fastcgi_pass   127.0.0.1:9000;
  fastcgi_index  index.php;
  fastcgi_param  SCRIPT_FILENAME  /scripts
  $fastcgi_script_name;
  include        fastcgi_params;
  }
  FastCGI Example
  First thing, I recommend keeping all your typical FCGI settings in a
  single file and importing them.
  For example you might have an /etc/nginx/fastcgi.conf (or
  /etc/nginx/fastcgi_params: installed by default on debian) file that
  looks like this:
  #fastcgi_params
  fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
  fastcgi_param  SERVER_SOFTWARE    nginx;
  fastcgi_param  QUERY_STRING       $query_string;
  fastcgi_param  REQUEST_METHOD     $request_method;
  fastcgi_param  CONTENT_TYPE       $content_type;
  fastcgi_param  CONTENT_LENGTH     $content_length;
  fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
  fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
  fastcgi_param  REQUEST_URI        $request_uri;
  fastcgi_param  DOCUMENT_URI       $document_uri;
  fastcgi_param  DOCUMENT_ROOT      $document_root;
  fastcgi_param  SERVER_PROTOCOL    $server_protocol;
  fastcgi_param  REMOTE_ADDR        $remote_addr;
  fastcgi_param  REMOTE_PORT        $remote_port;
  fastcgi_param  SERVER_ADDR        $server_addr;
  fastcgi_param  SERVER_PORT        $server_port;
  fastcgi_param  SERVER_NAME        $server_name;
  并在所支持的主页面格式中添加php格式的主而,类似如下:
  location / {
  root   html;
  index  index.php index.html index.htm;
  }
  而后重启nginx。
  # service nginx restart
  Simple Load Balancing
  http {
  upstream myproject {
  server 127.0.0.1:8000 weight=3;
  server 127.0.0.1:8001;
  }
  server {
  listen 80;
  server_name www.a.com;
  location / {
  proxy_pass http://myproject;
  }
  }
  }
  Reverse Proxy with Caching
  http {
  proxy_cache_path  /data/nginx/cache  levels=1:2
  keys_zone=STATIC:10m
  inactive=24h  max_size=1g;
  server {
  location / {
  proxy_pass             http://1.2.3.4;
  proxy_set_header       Host $host;
  proxy_cache            STATIC;
  proxy_cache_valid      200  1d;
  proxy_cache_use_stale  error timeout invalid_header
  updating
  http_500 http_502 http_503 http_504;
  }
  }
  }
  补充:编译详细参数如下:
  #Nginx安装路径。如果没有指定,默认为 /usr/local/nginx。
  --prefix=PATH
  #Nginx可执行文件安装路径。只能安装时指定,如果没有指定,默认为PATH/sbin/nginx。
  --sbin-path=PATH
  #在没有给定-c选项下默认的nginx.conf的路径。如果没有指定,默认为
  PATH/conf/nginx.conf。
  --conf-path=PATH
  #在nginx.conf中没有指定pid指令的情况下,默认的nginx.pid的路径。如果没有指定,默认为 PATH/logs/nginx.pid。
  --pid-path=PATH
  #nginx.lock文件的路径。
  --lock-path=PATH
  #在nginx.conf中没有指定error_log指令的情况下,默认的错误日志的路径。如果没有指定,默认为 PATH/logs/error.log。
  --error-log-path=PATH
  #在nginx.conf中没有指定access_log指令的情况下,默认的访问日志的路径。如果没有指定,默认为 PATH/logs/access.log。
  --http-log-path=PATH
  #在nginx.conf中没有指定user指令的情况下,默认的nginx使用的用户。如果没有指定,默认为 nobody。
  --user=USER
  #在nginx.conf中没有指定user指令的情况下,默认的nginx使用的组。如果没有指定,默
  认为 nobody。
  --group=GROUP
  #指定编译的目录
  --builddir=DIR
  #启用 rtsig 模块
  --with-rtsig_module
  #允许或不允许开启SELECT模式,如果configure没有找到合适的模式,比如,kqueue(sun os)、epoll(linux kenel 2.6+)、rtsig(实时信号)
  --with-select_module(--without-select_module)
  #允许或不允许开启POLL模式,如果没有合适的,则开启该模式。
  --with-poll_module(--without-poll_module)
  #开启HTTP SSL模块,使NGINX可以支持HTTPS请求。这个模块需要已经安装了OPENSSL,在
  DEBIAN上是libssl-dev
  --with-http_ssl_module
  --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 代理模块
  --with-mail_ssl_module #启用 ngx_mail_ssl_module
  --with-cc=PATH #指定 C 编译器的路径
  --with-cpp=PATH #指定 C 预处理器的路径
  --with-cc-opt=OPTIONS #
  --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" 配置指令中的正则表达式也需要 PCRE 。
  --with-pcre=DIR #指定 PCRE 库的源代码的路径。
  --with-pcre-opt=OPTIONS #设置PCRE的额外编译选项。
  --with-md5=DIR #使用MD5汇编源码。
  --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 命令来检查一下当前的选项列表。


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.iyunv.com/thread-633032-1-1.html 上篇帖子: Nginx服务器的安装配置 下篇帖子: Nginx平滑升级和平滑重启
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表