• nginx+nginx-rtmp-module


    下载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文件已经有了。
  • 相关阅读:
    测试AtomicInteger的可见性、有序性、原子性
    java实现hssf导出excel文件及自定义选择路径工具类
    map转换成com.google.gson.JsonObject
    String[]转List<String>
    classLoader打破双亲委托机制
    类加载器的加密解密
    自定义类加载器和父委托机制
    java中获取项目路径
    JVM内置三大类加载器详细介绍
    初识继承和多态
  • 原文地址:https://www.cnblogs.com/TuWenHao/p/8945552.html
Copyright © 2020-2023  润新知