环境:linux,离线
首先准备nginx安装包,如nginx-1.12.2.tar.gz
即将安装的模块,如本文中的http_auth_request_module,用于在nginx接收请求时,先访问我们的鉴权服务,若返回200则表明有权继续访问,否则nginx将返回401
顺序执行:
tar -zvxf nginx-1.12.2.tar.gzcd nginx-1.12.2./configure --with-http_auth_request_modulemake install
第三步若提示"./configure: error: C compiler cc is not found",则需要安装gcc
离线安装gcc
查看linux版本,如centos7,则到镜像地址:
下载下列rpm:
rpm -Uvh *.rpm --nodeps --force
gcc -v 查看版本
继续第三步,若报错:
./configure: error: the HTTP rewrite module requires the PCRE library.
则还需安装pcre,安装方式同上
再次第三步,安装成功:
Configuration summary
+ using system PCRE library + OpenSSL library is not used + using system zlib librarynginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx" nginx modules path: "/usr/local/nginx/modules" nginx configuration prefix: "/usr/local/nginx/conf" nginx configuration file: "/usr/local/nginx/conf/nginx.conf" nginx pid file: "/usr/local/nginx/logs/nginx.pid" nginx error log file: "/usr/local/nginx/logs/error.log" nginx http access log file: "/usr/local/nginx/logs/access.log" nginx http client request body temporary files: "client_body_temp" nginx http proxy temporary files: "proxy_temp" nginx http fastcgi temporary files: "fastcgi_temp" nginx http uwsgi temporary files: "uwsgi_temp" nginx http scgi temporary files: "scgi_temp"