Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build a simple Live Server with Nginx

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

It is believed that many inexperienced people have no idea about how to build a simple LVB server in Nginx. Therefore, this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

Preface

Use Nginx + Nginx-rtmp-module to build a simple rtmp push LVB server in Ubuntu.

Server environment

Ubuntu 16.04

Related concepts

RTMP: RTMP protocol is the abbreviation of Real Time Message Protocol (Real-time Information transfer Protocol). It is an application layer protocol proposed by Adobe Company. Rely on flash broadcasters to pull streams.

Request style: rtmp://xxx.xxx.xxx.xxx:1935/ttest (namespace) / test (push code)

HLS: Apple's Http Live Streaming protocol, which simply works by dividing a video stream into small HTTP-based files to download. Read a video stream clip by reading the .m3u8 file.

Request style: http://xxx.xxx.xxx.xxx/video(nginx configure routing) / test.m3u8

Nginx-rtmp-module: streaming Media Server based on Nginx

Testing tool

1. Push tool: easy push (ios)

two。 Pull tool: VLC media player (pc)

Implementation steps

Install or upgrade Nginx

Sudo apt-get install software-properties-common python-software-properties sudo add-apt-repository ppa:nginx/stable sudo apt-get update sudo apt-get install nginx

Second, install nginx-rtmp-module

Sudo apt-get install libnginx-mod-rtmp

Third, write nginx configuration

1. / etc/nginx/nginx.conf

User ubuntu; rtmp {server {listen 1935; chunk_size 4000; application test {live on; record off; hls on; hls_path / usr/local/src/nginx/html/test; hls_fragment 1s; hls_playlist_length 3s;}

2. / etc/nginx/sites-enables/default

Location / video/ {alias / usr/local/src/nginx/html/godeyeTest/; # the remaining three lines are configured to solve cross-domain problems add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Methods' GET, POST, OPTIONS'; add_header Access-Control-Allow-Headers' DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';}

Create a new path and restart the nginx service

1. Path in mkdir configuration (/ usr/local/src/nginx/html/test)

2. Serive nginx restart

After reading the above, have you mastered how Nginx can build a simple LVB server? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report