yum install -y gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
wget https://mirrors.huaweicloud.com/nginx/nginx-1.19.6.tar.gz
如果提示“-bash: wget: 未找到命令”,则先运行yum install wget -y
nginx-http-flv-module 模块包下载:点击这里下载zip文件
创建编译目录
mkdir /usr/local/nginx
解压文件。如果提示“-bash: unzip: 未找到命令”,则先运行 yum install unzip -y
tar xvf nginx-1.19.6.tar.gz
进入nginx目录
cd nginx-1.19.6
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module --add-module=/opt/nginx-http-flv-module-masterr
make && make install
创建服务文件nginx.servicevim /usr/lib/systemd/system/nginx.service
添加以下内容:
[Unit] Description=nginx - high performance web server After=network.target remote-fs.target nss-lookup.target [Service] Type=forking ExecStart=/usr/local/nginx/sbin/nginx ExecReload=/usr/local/nginx/sbin/nginx -s reload ExecStop=/usr/local/nginx/sbin/nginx -s stop [Install] WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable nginx && systemctl start nginx