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

前端之家收集整理的这篇文章主要介绍了/etc/nginx/nginx.conf:76中的未知指令“ rtmp” 前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我正在尝试建立服务器以通过网络摄像头进行分层,我是来自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停止

原文链接:https://www.f2er.com/nginx/532307.html

猜你在找的Nginx相关文章