加入收藏 | 设为首页 | 会员中心 | 我要投稿 阜阳站长网 (https://www.0558zz.com/)- 科技、建站、内容创作、云计算、网络安全!
当前位置: 首页 > 运营中心 > Nginx > 正文

/etc/nginx/nginx.conf:76中的未知指令“ rtmp”

发布时间:2021-01-11 21:42:54 所属栏目:Nginx 来源:互联网
导读:我正在尝试建立服务器以通过网络摄像头进行分层,我是来自Ubuntu的相对较新的用户,并安装了Nginx,现在,我尝试修改nginx.conf并配置rtmp服务器,这是我的脚本文件user www-data; worker_processes 4; pid /run/nginx.pid; events { worker_connections

我正在尝试建立服务器以通过网络摄像头进行分层,我是来自Ubuntu的相对较新的用户,并安装了Nginx,现在,我尝试修改nginx.conf并配置rtmp服务器,这是我的脚本文件

user www-data;

worker_processes 4;

pid /run/nginx.pid;

events {

    worker_connections 768;

    # multi_accept on;
}

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    # server_tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;
    gzip_disable "msie6";

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

    ##
    # nginx-naxsi config
    ##
    # Uncomment it if you installed nginx-naxsi
    ##

    #include /etc/nginx/naxsi_core.rules;

    ##
    # nginx-passenger config
    ##
    # Uncomment it if you installed nginx-passenger
    ##

    #passenger_root /usr;
    #passenger_ruby /usr/bin/ruby;

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}


rtmp {

    server {

        listen 1935;

        chunk_size 8192;


        application vod {

            play /home/juanbg/vod ;

        }

        application live {

            live on;

            record off;

        }

    }

}

为了对此进行修改,我为ubuntu使用了升华文本3,保存了文件,当我尝试在终端中运行nginx时,会发生这种情况:

juanbg@JuanBG:~$sudo nginx
nginx: [emerg] unknown directive "rtmp" in /etc/nginx/nginx.conf:76

我在该网站和其他网站上都阅读了所有类似情况,这都是有问题的,因为rtmp放在http(http {rtmp {}})的括号内,但在这种情况下不是(或者不是我所知道的). 最佳答案 我知道这个问题已经很老了,但这可能对其他人有帮助.

为rtmp安装nginx时,必须从源代码编译程序. (e.g. as desecribed here)

简而言之:

 sudo apt-get install build-essential libpcre3 libpcre3-dev libssl-dev
 wget http://nginx.org/download/nginx-1.9.2.tar.gz
 wget https://github.com/arut/nginx-rtmp-module/archive/master.zip
 unzip master.zip     
 tar -zxvf nginx-1.9.2.tar.gz

如果要使用http://nginx.org/download/的最新版本,请适当更改版本号.

 cd nginx-1.9.2
 ./configure --with-http_ssl_module --add-module=../nginx-rtmp-module-master
 make
 sudo make install

现在,必须更改nginx.conf.

确保启动正确的二进制文件,并在命令行上使用哪个nginx对其进行检查.这应该指向/usr/local/nginx / sbin / nginx,否则rtmp-module是未知的.

开始于:nginx

停止:nginx -s停止

(编辑:阜阳站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读