环境:centos7
nginx版本:nginx-1.16.1
yum -y install gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre pcre-devel gd-* patch
useradd -s /sbin/nologin nginx
mkdir -p /usr/local/nginx
语法:
cd nginx-1.16.1 && ./configure --prefix=安装目录 --模块选项
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --user=nginx
make && make install
大部分模块都已内置到默认编译选项中,即使编译时不添加也会自动编译进去
模块 | 作用 |
---|---|
ngx_http_core_module | 包括一些核心的http参数配置,对应Nginx的配置为HTTP区块部分 |
ngx_http_access_module | 访问控制模块,用来控制网站用户对Nginx的访问 |
ngx_http_gzip_module | 压缩模块,对Nginx返回的数据压缩,属于性能优化模块 |
ngx_http_fastcgi_module | FastCGI模块,和 动态应用相关的模块,例如PHP |
ngx_http_proxy_module | Proxy代理模块 |
ngx_http_upstream_module | 负载均衡模块,可以实现网站的负载均衡功能及节点的健康检查 |
ngx_http_rewrite_module | URL地址重写模块 |
ngx_http_limit_conn_module | 限制用户并发连接数及请求数模块 |
ngx_http_limit_req_module | 根据定义的key限制Nginx请求过程的速率 |
ngx_http_log_module | 访问日志模块,以指定的格式记录Nginx客户访问日志等信息 |
ngx_http_auth_basic_module | Web认证模块,设置Web用户通过账号、密码访问Nginx |
ngx_http_ssl_module | ssl模块,用于加密的http连接,如https |
ngx_http_stub_status_module | 记录Nginx基本访问状态信息等模块 |
nginx-auth-ldap | ldap模块 |
ngx_http_v2_module | 支持http2版本协议 |
ngx_http_gzip_static_module | 预读gzip功能 |
原文:https://www.cnblogs.com/yhy223/p/14542144.html