I
I
Igor Nistakov2014-12-10 19:10:46
Nginx
Igor Nistakov, 2014-12-10 19:10:46

Where did I make a mistake in the ngnix config file?

Hello! After command

nginx -t
here is an error
[email protected]:/home/denis# nginx -t
nginx: [emerg] "rtmp" directive is not allowed here in /etc/nginx/nginx.conf:76
nginx: configuration file /etc/nginx/nginx.conf test failed

Therefore, the error is in the rtmp {} block, here is the file itself
#user denis;
worker_processes 2;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;

events {
worker_connections 1024;
}

http {
include       mime.types;

   default_type  application/octet-stream;



   sendfile        on;

   keepalive_timeout  65;

   server {

       listen       8080;

       server_name  localhost;



       # rtmp stat

       location /stat {

           rtmp_stat all;

           rtmp_stat_stylesheet stat.xsl;

       }

       location /stat.xsl {

           # you can move stat.xsl to a different location

           root /usr/build/nginx-rtmp-module;

       }



       # rtmp control

       location /control {

           rtmp_control all;

       }



       error_page   500 502 503 504  /50x.html;

       location = /50x.html {

           root   html;

       }

   }




rtmp {

server {
  listen 1935;

       ping 30s;

       notify_method get;
hls on;

application camera1 {
live on;
record off;
exec_pull avconv -i rtsp://admin:[email protected]:554/ -threads 2 -f flv -r 25 -s 1280x720 -an 

rtmp://192.168.1.8:1935/cam1/stream
}
}
}

How to format the configuration file correctly?
Thank you.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
I
Igor Nistakov, 2014-12-11
@belloni

The problem is solved, the error was in the syntax, there was not enough ";" a rather strange situation I found out by the method of elimination, but the strange thing is that in no guide, even in the mana on the github, this detail is not. Here is the correct code:

application camera1 {
live on;
record off;
exec_pull avconv -i rtsp://admin:[email protected]:554/ -threads 2 -f flv -r 25 -s 1280x720 -an 

rtmp://192.168.1.8:1935/cam1/stream; #Закрывающая точка с зяпятой
}
}
}

This is how I lost 2 days. Thank you all for responding.

M
MaySky, 2014-12-10
@MaySky

As I understand it, the problem is in line 135 of the configuration, but somehow I don’t see a line with such a number in your nginx.conf.

K
Kir ---, 2014-12-10
@SowingSadness

rtmp directives are only available for rtmp applications.
And you have it in the http application.

E
Ergil Osin, 2014-12-10
@Ernillew

rtmp syntax: rtmp
{ ... }
context: root
The block which holds all RTMP settings You have a directive in the wrong block.

V
Vlad Zhivotnev, 2014-12-11
@inkvizitor68sl

Remove } from the end of the config and add it above the rtmp { line

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question