nginx.conf 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. user www-data;
  2. worker_processes 1; #si esto != 1 se rompe todo el curso en vivo
  3. #https://github.com/arut/nginx-rtmp-module/wiki/Directives#multi-worker-live-streaming
  4. #rtmp_auto_push on;
  5. #rtmp_auto_push_reconnect 1s;
  6. #rtmp_socket_dir /var/sock;
  7. pid /var/run/nginx.pid;
  8. events {
  9. worker_connections 1024;
  10. # multi_accept on;
  11. }
  12. rtmp {
  13. server {
  14. listen 1935;
  15. ping_timeout 30s;
  16. max_streams 64;
  17. chunk_size 4096;
  18. ack_window 2000000;
  19. interleave on; #defaults to off
  20. buflen 1s;
  21. sync 100ms;
  22. wait_video on;
  23. wait_key on;
  24. drop_idle_publisher 10s;
  25. #play_restart off; #seguro?
  26. play_restart on; #seguro?
  27. publish_notify on;
  28. publish_time_fix off;
  29. play_time_fix off;
  30. live on;
  31. application src {
  32. recorder rec0 {
  33. record all;
  34. record_path /var/videos/;
  35. record_unique on;
  36. }
  37. exec_push /usr/bin/pull_rtmp.sh;
  38. # exec_push /usr/bin/ffmpeg -i rtmp://localhost/src/$name
  39. # -c copy -f flv rtmp://localhost/hls/$name;
  40. # -c copy -f flv rtmp://localhost/hls/$name_high;
  41. # -c:v libx264 -s 360x270 -c:a copy -preset veryfast -r 10 -g 20 -f flv rtmp://localhost/hls/$name_low;
  42. }
  43. # application hls {
  44. # hls on;
  45. # hls_fragment_slicing plain;
  46. # hls_path /tmp/hls;
  47. # hls_fragment 15s;
  48. # hls_playlist_length 30s;
  49. # hls_type live;
  50. # }
  51. # hls_fragment_slicing aligned;
  52. # hls_nested on;
  53. # hls_variant _low BANDWIDTH=240000;
  54. # hls_variant _high BANDWIDTH=1000000;
  55. }
  56. }
  57. http {
  58. ##
  59. # Basic Settings
  60. ##
  61. #sendfile on;
  62. #tcp_nopush on;
  63. #tcp_nodelay on;
  64. #keepalive_timeout 65;
  65. types_hash_max_size 2048;
  66. client_max_body_size 100m;
  67. server_tokens off;
  68. # server_names_hash_bucket_size 64;
  69. # server_name_in_redirect off;
  70. include /etc/nginx/mime.types;
  71. default_type application/octet-stream;
  72. include /etc/nginx/ssl;
  73. ##
  74. # Logging Settings
  75. ##
  76. access_log /var/log/nginx/access.log;
  77. error_log /var/log/nginx/error.log;
  78. ##
  79. # Gzip Settings
  80. ##
  81. gzip on;
  82. gzip_vary on;
  83. gzip_proxied any;
  84. gzip_comp_level 6;
  85. gzip_min_length 100;
  86. gzip_proxied expired no-cache no-store private auth;
  87. gzip_buffers 16 8k;
  88. gzip_http_version 1.1;
  89. gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
  90. ##
  91. # Virtual Host Configs
  92. ##
  93. include /etc/nginx/conf.d/*.conf;
  94. include /etc/nginx/sites-enabled/*;
  95. }