nginx+nginx-rtmp-module

本文详细介绍了如何从GitHub下载并安装nginx-rtmp-module,包括必要的依赖库安装,以及如何配置nginx以支持RTMP模块。同时,文章还解决了在安装和启动过程中遇到的常见问题,如用户权限、nginx命令未找到和pid文件缺失等。

下载nginx-rtmp-module:

nginx-rtmp-module的官方github地址:https://github.com/arut/nginx-rtmp-module
使用命令:

git clone https://github.com/arut/nginx-rtmp-module.git

 

下载的内容放到~/nginx目录下。

nginx的官方网站为:http://nginx.org/en/download.html

 

安装关联模块:

不安装这两个增加NGINX模块将会报错:./configure: error: the HTTP rewrite module requires the PCRE library.

sudo apt-get install libpcre3 libpcre3-dev

sudo apt-get install openssl libssl-dev

增加NGINX模块

  ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module --with-http_gzip_static_module --with-http_ssl_module --with-http_flv_module --with-http_perl_module --with-mail --with-http_xslt_module --add-module='rtmp模块路径' --with-pcre=/root/pcre-8.31

 

./configure --prefix=/usr/local/nginx --with-pcre=../pcre-8.39 --with-http_ssl_module --with-http_v2_module --with-http_flv_module --with-http_mp4_module --add-module=../nginx-rtmp-module/

编译

sudo make

sudo make install

 

启动报错

没有安装nginx用户导致的无法启动

[root@localhost nginx-1.11.2]# /usr/local/nginx/sbin/nginx

nginx: [emerg] getpwnam("nginx") failed
 
[root@localhost nginx-1.11.2]# useradd -s /sbin/nologin -M nginx
[root@localhost nginx-1.11.2]# id nginx
 

nginx命令未找到

sudo nginx显示command not found。
类似的问题还有 sudo ll

问题解决

不采用修改PATH的方式,而是为nginx做一个软连接。

sudo ln -s /home/dev/share_dev/usr_local/nginx/sbin/nginx /usr/local/sbin/nginx

重启Linux即可

nginx.pid 文件未找到

重新启动服务器,访问web服务发现无法浏览啦!登陆服务器之后进到nginx使用./nginx -s reload重新读取配置文件,发现报nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)错误,进到logs文件发现的确没有nginx.pid文件
 
[root@localhost sbin]# ./nginx -s reload
nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)
 
解决方法:
[root@localhost nginx]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
 
使用nginx -c的参数指定nginx.conf文件的位置
 
[root@localhost nginx]# cd logs/
[root@localhost logs]# ll
总用量 12
-rw-r--r-- 1 root root 1246 12月  9 18:10 access.log
-rw-r--r-- 1 root root  516 12月 10 15:39 error.log
-rw-r--r-- 1 root root    5 12月 10 15:38 nginx.pid
 
看nginx.pid文件已经有了。

 

转载于:https://www.cnblogs.com/TuWenHao/p/8945552.html

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值