系统相关
首页 > 系统相关> > Centos7安装nginx用于搭建流媒体服务

Centos7安装nginx用于搭建流媒体服务

作者:互联网

安装环境:CentOS7.9

image

1 安装一些依赖库:

yum install -y gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel

2 下载nginx-1.19.6源码 和 nginx-http-flv-module

wget https://mirrors.huaweicloud.com/nginx/nginx-1.19.6.tar.gz

如果提示“-bash: wget: 未找到命令”,则先运行yum install wget -y
nginx-http-flv-module 模块包下载:点击这里下载zip文件

image

3 编译安装nginx

创建编译目录

mkdir /usr/local/nginx

解压文件。如果提示“-bash: unzip: 未找到命令”,则先运行 yum install unzip -y

tar xvf nginx-1.19.6.tar.gz

image

进入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

4 为nginx添加systemctl启动方式

创建服务文件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

5 启动nginx并加入开机自启动项

标签:流媒体,http,module,1.19,Centos7,nginx,usr,local
来源: https://www.cnblogs.com/happylover/p/15354424.html