nginx

2023/9/19 nginx

# 1.官网下载tar包

官网 (opens new window) 原文地址 (opens new window)

# 2.安装

进入到 /usr/local目录 这个目录是存放用户安装的一些东西 cd /usr/local

# 第一步:把 nginx 的源码包nginx-1.8.0.tar.gz上传到 linux 系统(笔者是通过安装lrzsz,然后输入rz后会弹出要上传的文件目录,用户选择)sz就是下载。其他方式也有请自行百度

# 第二步:解压缩

tar zxvf nginx-1.8.0.tar.gz

# 第三步:进入nginx-1.8.0目录

可以看到有一个configure可执行文件,绿色代表可执行文件 使用 configure 命令创建makeFile文件。

  # 后面的参数可以自定义 但是必须要不然make会报错 //make: *** 没有规则可以创建“default”需要的目标“build”。 停止。
  ./configure \
  --prefix=/usr/local/nginx \
  --pid-path=/var/run/nginx/nginx.pid
  --lock-path=/var/lock/nginx.lock \
  --error-log-path=/var/log/nginx/error.log \
  --http-log-path=/var/log/nginx/access.log \
  --with-http_gzip_static_module \
  --http-client-body-temp-path=/var/temp/nginx/client \
  --http-proxy-temp-path=/var/temp/nginx/proxy \
  --http-fastcgi-temp-path=/var/temp/nginx/fastcgi \
  --http-uwsgi-temp-path=/var/temp/nginx/uwsgi \
  --http-scgi-temp-path=/var/temp/nginx/scgi
1
2
3
4
5
6
7
8
9
10
11
12
13

执行后可以看到Makefile文件 Makefile是一种配置文件, Makefile 一个工程中的源文件不计数,其按类型、功能、模块分别放在若干个目录中,makefile定义了一系列的规则来指定,哪些文件需要先编译,哪些文件需要后编译,哪些文件需要重新编译,甚至于进行更复杂的功能操作,因为 makefile就像一个Shell脚本一样,其中也可以执行操作系统的命令。

# configure参数

./configure \
--prefix=/usr \                                                        指向安装目录
--sbin-path=/usr/sbin/nginx \                                 指向(执行)程序文件(nginx)
--conf-path=/etc/nginx/nginx.conf \                      指向配置文件
--error-log-path=/var/log/nginx/error.log \              指向log
--http-log-path=/var/log/nginx/access.log \            指向http-log
--pid-path=/var/run/nginx/nginx.pid \                      指向pid
--lock-path=/var/lock/nginx.lock \                         (安装文件锁定,防止安装文件被别人利用,或自己误操作。)
--user=nginx \
--group=nginx \
--with-http_ssl_module \                      启用ngx_http_ssl_module支持(使支持https请求,需已安装openssl)
--with-http_flv_module \                       启用ngx_http_flv_module支持(提供寻求内存使用基于时间的偏移量文件)
--with-http_stub_status_module \     启用ngx_http_stub_status_module支持(获取nginx自上次启动以来的工作状态)
--with-http_gzip_static_module \   启用ngx_http_gzip_static_module支持(在线实时压缩输出数据流)
--http-client-body-temp-path=/var/tmp/nginx/client/ \ 设定http客户端请求临时文件路径
--http-proxy-temp-path=/var/tmp/nginx/proxy/ \ 设定http代理临时文件路径
--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \ 设定http fastcgi临时文件路径
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \ 设定http uwsgi临时文件路径
--http-scgi-temp-path=/var/tmp/nginx/scgi \ 设定http scgi临时文件路径
--with-pcre 启用pcre库

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

# 第四步:编译

make

# 第五步:安装

make install

注意:启动nginx 之前,因为上边configure命令将临时文件目录指定为/var/temp/nginx/client 参考 --http-client-body-temp-path=/var/temp/nginx/client \

所以需要在/var/temp/nginx/client 下创建此目录 mkdir /var/temp/nginx/client -p 返回查看 /usr/local目录,可以看到多了一个nginx目录 进入到nginx目录可以看到有三个文件夹 conf是配置文件所在目录,html是静态文件默认所在目录(可以修改静态文件位置,不放在这儿),sbin是二进制命令所在目录 进入到Nginx目录下的sbin目录 cd sbin/ 可以看到只有一个nginx

# 3.nginx 启动

# 输入命令启动Nginx

./nginx

# nginx退出与重加载

./nginx -s stop非正常退出,相当于杀进程 ./nginx -s quit正常退出 ./nginx -s reload重新加载配置文件,就是加载上面的Makefile

# 4.nginx静态网站部署

  1. 首先进入到/usr/local/nginx/conf目录下,可以看到有一个nginx.cnf文件 点开/usr/local/nginx/conf目录双击nginx.conf打开在右侧可以看到具体文件内容。 重点关注以下内容
  • root是默认访问目录,这个html目录位于/usr/local/nginx目录下,index是默认访问的文件,也就是说直接输入ip访问到的内容,即nginx访问页。所以我们需要将自己项目中的index目录(一些静态资源例如html和css,font,js,image等)放到/usr/local/nginx目录下。使用xftp软件或者其他方式。
  1. 连接后右侧进入到/usr/local/nginx目录,将左侧的index目录拖到右侧即可然后在editplus中将root对应的html目录名改为index。
  2. 然后进入到/usr/lcoal/nginx/sbin目录,
  3. 每次电脑开机后重新启动nginx后都会报错 nginx: [error] open() “/usr/local/var/run/nginx.pid” failed (2: No such file or directory) 报错的原因就是没有nginx文件夹或没有nginx.pid文件 原因就是每次重新启动,系统都会自动删除文件,所以需要更改pid文件存储的位置** 将pid前的#去掉,然后保存,然后在/usr/local/nginx目录下创建logs目录 然后在sbin/ 路径下执行 ./nginx -c /usr/local/nginx/conf/nginx.conf或者执行./nginx -s reload重新加载配置文件就会自动在logs下生成nginx.pid文件。 最后在/usr/local/nginx/sbin目录执行./nginx命令启动nginx在浏览器输入ip访问即可。

# 配置虚拟主机

虚拟主机,也叫“网站空间”,就是把一台运行在互联网上的物理服务器划分成多个“虚拟”服务器。虚拟主机技术极大的促进了网络技术的应用和普及。同时虚拟主机的租用服务也成了网络时代的一种新型经济形式。

# 端口绑定

例如有多个静态页面目录,不同的目录需要不同的端口,这就需要在/usr/local/nginx/conf/nginx.conf添加多个server。

首先将多个静态页面所在目录上传至 /usr/local/nginx目录下并修改Nginx 的配置文件: /usr/local/nginx/conf/nginx.conf 主要修改listen和root,index。如果是配置在不同的linux环境则需要修改server_name

server {
        listen       80; # 监听的端口
        server_name  localhost; # 域名或ip
        location / {	# 访问路径配置
            root   index;# 根目录
            index  index.html index.htm; # 默认首页
        }
        error_page   500 502 503 504  /50x.html;	# 错误页面
        location = /50x.html {
            root   html;
        }
    }
     server {
        listen       81; # 监听的端口
        server_name  localhost; # 域名或ip
        location / {	# 访问路径配置
            root   regist;# 根目录
            index  regist.html; # 默认首页
        }
        error_page   500 502 503 504  /50x.html;	# 错误页面
        location = /50x.html {
            root   html;
        }   
    }

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

修改完成后,进入/usr/local/nginx/sbin目录执行./nginx -s reload重新加载配置文件后就可以访问测试。

# 域名绑定

域名与IP绑定: 一个域名对应一个 ip 地址,一个 ip 地址可以被多个域名绑定。 当我们在浏览器地址栏输入域名地址时如www.baidu.com,它首先会去C:\Windows\System32\drivers\etc这个目录找域名和ip的映射关系,如果找到了就访问对应的ip,找不到就会走dns服务器。 在hosts文件可以配置域名和 ip 的映射关系,如果 hosts 文件中配置了域名和 ip 的对应关系,不需要走dns 服务器。本地测试可以修改 hosts 文件(C:\Windows\System32\drivers\etc),添加如下内容 ip地址 域名 即可做好域名指向后,修改完成后需要修改nginx配置文件

server {
    listen       80;
    server_name  域名(如www.baidu.com);
    location / {
        root   index;
        index  index.html;
    }
}
1
2
3
4
5
6
7
8

然后进入/usr/local/nginx/sbin目录执行以下命令,刷新配置文件 ./nginx -s reload 如果nginx关闭了,再执行 ./nginx 启动nginx 然后就可以在地址栏输入http://域名进行访问了

# Nginx反向代理与负载均衡

# 反向代理

# 什么是反向代理

反向代理(Reverse Proxy)方式是指以代理服务器来接受internet上的连接请求,然后将请求转发给内部网络上的服务器,并将从服务器上得到的结果返回给internet上请求连接的客户端,此时代理服务器对外就表现为一个反向代理服务器。 首先我们先理解正向代理,如下图: 正向代理是针对你的客户端,而反向代理是针对服务器的,如下图

# 配置反向代理-准备工作

将项目部署到tomcat中,上传到服务器。

# 配置反向代理

在Nginx主机修改 Nginx配置文件

upstream tomcat-test{
    server 192.168.3.12:8080;
 }
 server {
     listen       80; # 监听的端口
     server_name  www.test.com; # 域名或ip
     location / {	# 访问路径配置
         # root   index;# 根目录
     proxy_pass http://tomcat-test.com;
         index  index.html index.htm; # 默认首页
     }
}

1
2
3
4
5
6
7
8
9
10
11
12
13

重新启动Nginx 然后用浏览器测试:http://www.test.com (此域名须配置域名指向),参考上面的域名绑定。

# 负载均衡

# 什么是负载均衡

负载均衡 建立在现有网络结构之上,它提供了一种廉价有效透明的方法扩展网络设备和服务器的带宽、增加吞吐量、加强网络数据处理能力、提高网络的灵活性和可用性。 负载均衡,英文名称为Load Balance,其意思就是分摊到多个操作单元上进行执行,例如Web服务器、FTP服务器、企业关键应用服务器和其它关键任务服务器等,从而共同完成工作任务。

# 配置负载均衡-准备工作

进入这个目录,执行以下命令 cp ./apache-tomcat-7.0.106 tomcat1 cp ./apache-tomcat-7.0.106 tomcat2 将/ur/local/apache-tomcat-7.0.106复制两份,apache-tomcat-7.0.106中的server.xml不用修改,tomcat1和tomcat2的端口都要修改(在其server.xml中修改)tomcat1的serverl.xml中的所有涉及到的端口全部+1,tomcat2serverl.xml中的所有涉及到的端口全部+2。 执行以下命令如 cd t/usr/local/tomcat/tomcat1/bin ./startup.sh 另两个同理,记得把tomcat1换名。 分别启动这三个tomcat服务。 为了能够区分是访问哪个服务器的网站,可以在项目的起始访问首页标题加上标记以便区分。如

8080 4.2.3 配置负载均衡 修改 Nginx配置文件:

  upstream tomcat-test {
	   server 192.168.3.12:8080;
	   server 192.168.3.12:8081;
	   server 192.168.3.12:8082;
    }
    server {
        listen       80; # 监听的端口
        server_name  www.test.com; # 域名或ip
        location / {	# 访问路径配置
            # root   index;# 根目录
	    proxy_pass http://tomcat-test.com;

            index  index.html index.htm; # 默认首页
        }
        error_page   500 502 503 504  /50x.html;	# 错误页面
        location = /50x.html {
            root   html;
        }
    }

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

地址栏输入http:// www.test.com / 刷新观察每个网页的标题,看是否不同。 经过测试,三台服务器出现的概率各为33.3333333%,交替显示。 如果其中一台服务器性能比较好,想让其承担更多的压力,可以设置权重。 比如想让NO.1出现次数是其它服务器的2倍,则修改配置如下:

    upstream tomcat-test {
	   server 192.168.3.12:8080;
	   server 192.168.3.12:8081 weight=2;
	   server 192.168.3.12:8082;
    }

1
2
3
4
5
6

经过测试,每刷新四次,有两次是8081

# install

如果没有gcc环境,需要安装gcc:
yum install gcc-c++

安装依赖
yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel

# 进入文件夹
cd  /usr/local

#下载安装包
wget http://nginx.org/download/nginx-1.18.0.tar.gz

#解压安装包
tar -xvf nginx-1.18.0.tar.gz 

#解压之后不需要重新命名直接进去解压目录
#进入nginx-1.18.0目录 
cd /usr/local/nginx-1.18.0

#执行命令
#prefix= 指向安装目录(编译安装)
#conf-path= 指向配置文件(nginx.conf)
#error-log-path= 指向错误日志目录
#pid-path= 指向pid文件(nginx.pid)
#http-log-path= 设定access log路径
#with-http_gzip_static_module 启用ngx_http_gzip_static_module支持(在线实时压缩输出数据流)
#with-http_stub_status_module 启用ngx_http_stub_status_module支持(获取nginx自上次启动以来的工作状态)
#with-http_ssl_module 启用ngx_http_ssl_module支持(使支持https请求,需已安装openssl)

./configure --prefix=/usr/local/nginx --conf-path=/usr/local/nginx/conf/nginx.conf  --error-log-path=/usr/local/nginx/logs/error.log --pid-path=/usr/local/nginx/logs/nginx.pid  --http-log-path=/usr/local/nginx/logs/access.log --with-http_gzip_static_module --with-http_stub_status_module --with-http_ssl_module

#执行命令
make

#执行make install命令 
make install

#启动nginx
 cd  /usr/local/nginx/sbin
./nginx

#查看nginx进程
ps -ef | grep nginx

#打开阿里云的网路安全组开放80端口

#在浏览器访问服务器ip

#设置开机自动启动
vim /lib/systemd/system/nginx.service
#按i编辑 把下面复制进去  按esc建  再按shift+:键 wq  保存退出

[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
#自己nginx启动的pid文件自己找到文件目录
PIDFile=/usr/local/nginx/logs/nginx.pid
#自己nginx的启动文件 
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
#默认
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target


#启动
systemctl start nginx.service

设置开机自启
systemctl enable nginx.service

#提示
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.

#停止开机自启动
systemctl disable nginx.service

#查看服务当前状态
systemctl status nginx.service

#重新启动服务
systemctl reload nginx.service

#停止服务
systemctl stop nginx.service


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93

# nginx编译安装之-./configure 参数详解

--with开头的,默认是禁用的(没启动的,想使用的话需要在编译的时候加上)

 --without开头的,默认是启用的(不想启用此模块时,可以在编译的时候加上这个参数)

 编译安装示例(从生产上贴下来的,nginx-1.16)

./configure --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-file-aio

 --prefix=  指向安装目录。

 --sbin-path=  指定执行程序文件存放位置。

 --modules-path=  指定第三方模块的存放路径。

 --conf-path= 指定配置文件存放位置。

 --error-log-path=  指定错误日志存放位置。

 --pid-path=  指定pid文件存放位置。

 --lock-path=  指定lock文件存放位置。

 --user=  指定程序运行时的非特权用户。

 --group=  指定程序运行时的非特权用户组。

 --builddir=  指向编译目录。

 --with-rtsig_module  启用rtsig模块支持。

 --with-select_module  启用select模块支持,一种轮询处理方式,不推荐在高并发环境中使用,禁用:--without-select_module。

 --with-poll_module  启用poll模块支持,功能与select相同,不推荐在高并发环境中使用。

 --with-threads 启用thread pool支持。

 --with-file-aio  启用file aio支持。

 --with-http_ssl_module 启用https支持。

 --with-http_v2_module    启用ngx_http_v2_module支持。

 --with-ipv6    启用ipv6支持。

 --with-http_realip_module    允许从请求报文头中更改客户端的ip地址,默认为关。

 --with-http_addition_module    启用ngix_http_additon_mdoule支持(作为一个输出过滤器,分部分响应请求)。

 --with -http_xslt_module    启用ngx_http_xslt_module支持,过滤转换XML请求 。

 --with-http_image_filter_mdoule  启用ngx_http_image_filter_module支持,传输JPEG\GIF\PNG图片的一个过滤器,默认不启用,需要安装gd库。

 --with-http_geoip_module  启用ngx_http_geoip_module支持,用于创建基于MaxMind GeoIP二进制文件相配的客户端IP地址的ngx_http_geoip_module变量。

 --with-http_sub_module  启用ngx_http_sub_module支持,允许用一些其他文本替换nginx响应中的一些文本。

 --with-http_dav_module  启用ngx_http_dav_module支持,增加PUT、DELETE、MKCOL创建集合,COPY和MOVE方法,默认为关闭,需要编译开启。

 --with-http_flv_module  启用ngx_http_flv_module支持,提供寻求内存使用基于时间的偏移量文件。

 --with-http_mp4_module  启用ngx_http_mp4_module支持,启用对mp4类视频文件的支持。

 --with-http_gzip_static_module  启用ngx_http_gzip_static_module支持,支持在线实时压缩输出数据流。

 --with-http_random_index_module  启用ngx_http_random_index_module支持,从目录中随机挑选一个目录索引。

 --with-http_secure_link_module  启用ngx_http_secure_link_module支持,计算和检查要求所需的安全链接网址。

 --with-http_degradation_module  启用ngx_http_degradation_module 支持允许在内存不足的情况下返回204或444代码。

 --with-http_stub_status_module  启用ngx_http_stub_status_module 支持查看nginx的状态页。

 --without-http_charset_module  禁用ngx_http_charset_module这一模块,可以进行字符集间的转换,从其它字符转换成UTF-8或者从UTF8转换成其它字符。它只能从服务器到客户端方向,只有一个字节的字符可以转换。

 --without-http_gzip_module  禁用ngx_http_gzip_module支持,同--with-http_gzip_static_module功能一样。

 --without-http_ssi_module  禁用ngx_http_ssi_module支持,提供了一个在输入端处理服务器包含文件(SSI)的过滤器。

 --without-http_userid_module  禁用ngx_http_userid_module支持,该模块用来确定客户端后续请求的cookies。

 --without-http_access_module  禁用ngx_http_access_module支持,提供了基于主机ip地址的访问控制功能。

 --without-http_auth_basic_module  禁用ngx_http_auth_basic_module支持,可以使用用户名和密码认证的方式来对站点或部分内容进行认证。

 --without-http_autoindex_module  禁用ngx_http_authindex_module,该模块用于在ngx_http_index_module模块没有找到索引文件时发出请求,用于自动生成目录列表。

 --without-http_geo_module  禁用ngx_http_geo_module支持,这个模块用于创建依赖于客户端ip的变量。

 --without-http_map_module  禁用ngx_http_map_module支持,使用任意的键、值 对设置配置变量。

 --without-http_split_clients_module 禁用ngx_http_split_clients_module支持,该模块用于基于用户ip地址、报头、cookies划分用户。

 --without-http_referer_module  禁用ngx_http_referer_modlue支持,该模块用来过滤请求,报头中Referer值不正确的请求。

 --without-http_rewrite_module  禁用ngx_http_rewrite_module支持。该模块允许使用正则表达式改变URI,并且根据变量来转向以及选择配置。如果在server级别设置该选项,那么将在location之前生效,但如果location中还有更进一步的重写规则,location部分的规则依然会被执行。如果这个URI重写是因为location部分的规则造成的,那么location部分会再次被执行作为新的URI,这个循环会被执行10次,最后返回一个500错误。

 --without-http_proxy_module  禁用ngx_http_proxy_module支持,http代理功能。

 --without-http_fastcgi_module  禁用ngx_http_fastcgi_module支持,该模块允许nginx与fastcgi进程交互,并通过传递参数来控制fastcgi进程工作。

 --without-http_uwsgi_module  禁用ngx_http_uwsgi_module支持,该模块用来使用uwsgi协议,uwsgi服务器相关。

 --without-http_scgi_module  禁用ngx_http_scgi_module支持,类似于fastcgi,也是应用程序与http服务的接口标准。

 --without-http_memcached_module  禁用ngx_http_memcached支持,用来提供简单的缓存,提高系统效率。

 --without-http_limit_conn_module  禁用ngx_http_limit_conn_module支持,该模块可以根据条件进行会话的并发连接数进行限制。

 --without-http_limit_req_module  禁用ngx_limit_req_module支持,该模块可以实现对于一个地址进行请求数量的限制。

 --without-http_empty_gif_module  禁用ngx_http_empty_gif_module支持,该模块在内存中常驻了一个1*1的透明gif图像,可以被非常快速的调用。

 --without-http_browser_module  禁用ngx_http_browser_mdoule支持,创建依赖于请求报头的值 。如果浏览器为modern,则$modern_browser等于modern_browser_value的值;如果浏览器为old,则$ancient_browser等于$ancient_browser_value指令分配的值;如果浏览器为MSIE,则$msie等于1。

 --without-http_upstream_ip_hash_module 禁用ngx_http_upstream_ip_hash_module支持,该模块用于简单的负载均衡。

 --with-http_perl_module  启用ngx_http_perl_module支持,它使nginx可以直接使用perl或通过ssi调用perl。

 --with-perl_modules_path=  设定perl模块路径

 --with-perl=  设定perl库文件路径

 --http-log-path=  设定access log路径

 --http-client-body-temp-path=  设定http客户端请求临时文件路径

 --http-proxy-temp-path=  设定http代理临时文件路径

 --http-fastcgi-temp-path=  设定http fastcgi临时文件路径

 --http-uwsgi-temp-path=  设定http scgi临时文件路径

 --http-scgi-temp-path=  设定http scgi临时文件路径

 --without-http  禁用http server功能

 --without-http-cache  禁用http cache功能

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

 --with-mail_ssl_module  启用ngx_mail_ssl_module支持

 --without-mail_pop3_module  禁用pop3协议。

 --without-mail_iamp_module  禁用iamp协议。

 --without-mail_smtp_module  禁用smtp协议。

 --with-google_perftools_module  启用ngx_google_perftools_mdoule支持,调试用,可以用来分析程序性能瓶颈。

 --with-cpp_test_module 启用ngx_cpp_test_module支持。

 --add-module=  指定外部模块路径,启用对外部模块的支持。

 --with-cc=  指向C编译器路径。

 --with-cpp=  指向C预处理路径。

 --with-cc-opt=  设置C编译器参数,指定--with-cc-opt="-I /usr/lcal/include",如果使用select()函数,还需要同时指定文件描述符数量--with-cc-opt="-D FD_SETSIZE=2048"。 (PCRE库)

 --with-ld-opt=  设置连接文件参数,需要指定--with-ld-opt="-L /usr/local/lib"。(PCRE库)

 --with-cpu-opt=  指定编译的CPU类型,如pentium,pentiumpro,...amd64,ppc64...

 --without-pcre  禁用pcre库。

 --with-pcre  启用pcre库。

 --with-pcre=  指向pcre库文件目录。

 --with-pcre-opt=  在编译时为pcre库设置附加参数 。

 --with-md5=  指向md5库文件目录。

 --with-md5-opt=  编译时为md5库设置附加参数。

 --with-md5-asm  使用md5汇编源。

 --with-sha1=  指向sha1库文件目录。

 --with-sha1-opt=  编译时为sha1库设置附加参数。

 --with-sha1-asm  使用sha1汇编源。

 --with-zlib=  指向zlib库文件目录。

 --with-zlib-opt=  在编译时为zlib设置附加参数。

 --with-zlib-asm=  为指定的CPU使用汇编源进行优化。

 --with-libatomic  为原子内存的更新操作的实现提供一个架构。

 --with-libatomic=  指向libatomic_ops的安装目录。

 --with-openssl=  指向openssl安装目录。

 --with-openssl-opt=  在编译时为openssl设置附加参数。

 --with-debug  启用debug日志。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199