Answer the question
In order to leave comments, you need to log in
Where did I make a mistake in the ngnix config file?
Hello! After command
nginx -there 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
#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
}
}
}
Answer the question
In order to leave comments, you need to log in
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; #Закрывающая точка с зяпятой
}
}
}
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.
rtmp directives are only available for rtmp applications.
And you have it in the http application.
rtmp syntax:
rtmp
{ ... }
context: root
The block which holds all RTMP settings
You have a directive in the wrong block.
Remove } from the end of the config and add it above the rtmp { line
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question