Nginx安装

yum 安装

  1. epel 源安装
epel 源安装nginx
yum install epel-release -y
yum install nginx -y

# 查看 nginx 版本
rpm -qa |grep nginx-
nginx-1.12.2-3.el7.aarch64

  1. nginx源安装
配置nginx官方源安装
# 官方源地址:https://nginx.org/packages/centos/
在地址中找到自己系统对应的 nginx 版本

# 安装
yum install https://nginx.org/packages/centos/7/aarch64/RPMS/nginx-1.22.0-1.el7.ngx.aarch64.rpm -y

编译安装

  1. 安装nginx 所需要的依赖包
    pcre:使nginx支持具备RUI重写功能的Rewrite模块
    openssl:https 加密使用

yum install -y pcre-devel openssl openssl-devel pcre
useradd -s /sbin/nologin www -M

  1. 编译安装
编译安装
./configure --user=www --group=www --prefix=/usr/local/nginx-1.14.0/ --with-http_stub_status_module --with-http_ssl_module --with-pcre

make -j2 && make install
# 做软链接,方便后期升级nginx版本;
ln -s /usr/local/nginx-1.14.0 /usr/local/nginx

  • configure 参数的作用
    --prefix=PATH 路径
    --user=USER 用户
    -- group=GROUP -
    -with-pcre 伪静态
    --with-http_stub_status_module 状态
    --with-http_ssl_module 加密 443
posted @ 2022-06-02 15:48  Star-Hitian  阅读(131)  评论(0)    收藏  举报