Mainline version 主线开发版
Stable version 稳定版本 nginx-1.22.1
Legacy version 历史版本
一、依赖包安装
# 系统初始化: 外网畅通, 关闭防火墙, 关闭SELinux [root@my-node10 ~]# yum install gcc gcc-c++ autoconf pcre pcre-devel
二、yum安装
[root@my-node10 ~]# vi /etc/yum.repos.d/nginx.repo [nginx-stable] name=nginx stable repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=1 enabled=1 gpgkey=https://nginx.org/keys/nginx_signing.key module_hotfixes=true [nginx-mainline] name=nginx mainline repo baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/ gpgcheck=1 enabled=0 gpgkey=https://nginx.org/keys/nginx_signing.key module_hotfixes=true
[root@my-node10 ~]# yum install nginx 安装: nginx x86_64 1:1.22.1-1.el8.ngx nginx-stable 828 k 下载软件包: nginx-1.22.1-1.el8.ngx.x86_64.rpm 190 kB/s | 828 kB 00:04
[root@my-node10 ~]# nginx -v nginx version: nginx/1.22.1 [root@my-node10 ~]# nginx -V nginx version: nginx/1.22.1 built by gcc 8.5.0 20210514 (Red Hat 8.5.0-4) (GCC) built with OpenSSL 1.1.1k FIPS 25 Mar 2021 (running with OpenSSL 1.1.1c FIPS 28 May 2019) TLS SNI support enabled configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --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-compat \ --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module \ --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module \ --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module \ --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module \ --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS \ -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 \ -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie'
--with-cc-opt: 设置额外的参数添加到CFLAGS变量
--with-ld-opt: 设置附加的参数,链接系统库
[root@my-node10 ~]# rpm -ql nginx /etc/logrotate.d/nginx # Nginx 日志轮替 /etc/nginx /etc/nginx/conf.d /etc/nginx/conf.d/default.conf /etc/nginx/fastcgi_params /etc/nginx/mime.types # HTTP 协议的 Content-Type /etc/nginx/modules # Nginx 模块目录 /etc/nginx/nginx.conf # Nginx 主配置文件 /etc/nginx/scgi_params # scgi 配置文件 /etc/nginx/uwsgi_params # uwsgi 配置文件 /usr/lib/.build-id /usr/lib/.build-id/0c /usr/lib/.build-id/0c/cb1557a11b7b6e176ef0b3783e6d7adb45bdfb /usr/lib/.build-id/2f /usr/lib/.build-id/2f/e1fe11fedc925a8ec19787a2954b3d93fcffd1 /usr/lib/systemd/system/nginx-debug.service /usr/lib/systemd/system/nginx.service /usr/lib64/nginx /usr/lib64/nginx/modules # Nginx 模块目录 /usr/libexec/initscripts/legacy-actions/nginx /usr/libexec/initscripts/legacy-actions/nginx/check-reload /usr/libexec/initscripts/legacy-actions/nginx/upgrade /usr/sbin/nginx # Nginx 命令 /usr/sbin/nginx-debug /usr/share/doc/nginx-1.22.1 # Nginx 帮助目录 /usr/share/doc/nginx-1.22.1/COPYRIGHT /usr/share/man/man8/nginx.8.gz /usr/share/nginx /usr/share/nginx/html # Nginx 默认站点目录 /usr/share/nginx/html/50x.html /usr/share/nginx/html/index.html /var/cache/nginx # Nginx 缓存目录 /var/log/nginx # Nginx 日志目录
三、二进制安装