未知指令“;rtmp“;in/etc/nginx/nginx.conf:76

未知指令“;rtmp“;in/etc/nginx/nginx.conf:76,nginx,Nginx,我正在尝试建立一个服务器,通过网络摄像头进行扫描,我是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 #

我正在尝试建立一个服务器,通过网络摄像头进行扫描,我是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;

        }

    }

}
为了修改这一点,我使用sublime text 3 for ubuntu,保存了文件,当我尝试在终端中运行nginx时,会发生以下情况:

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

我在这个网站和其他网站上看到了所有类似的情况,所有这些都是问题,因为rtmp在http(http{rtmp{}})的括号内,但在这种情况下不是(或者我不知道)。

通过自制安装nginx。确保使用带有rtmp模块的
--
标志


另外请注意,这个问题安装到
/usr/local/etc/nginx

我知道这个问题很老了,但这可能对其他人有帮助

安装nginx for rtmp时,必须从源代码编译程序。()

简言之:

 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
如果您想使用中的最新版本,请更改相应的版本号

 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模块未知。

开始:
nginx


停止:
nginx-s停止

有一个类似的问题(尽管是在另一个操作系统上): nginx:[emerg]在/usr/local/etc/nginx/rtmp enabled/test.conf:2中的未知指令“rtmp”

这是我的工作:

在make(使安装干净)之后,编辑配置(/usr/local/etc/nginx/nginx.conf)并添加行:

load_module /usr/local/libexec/nginx/ngx_rtmp_module.so;

对于Linux,库的路径将不同。

nginx中是否启用rtmp?e、 g.rtmp模块是否已安装/编译?
load_module /usr/local/libexec/nginx/ngx_rtmp_module.so;