Skip to content

Instantly share code, notes, and snippets.

@fuji246
Last active June 25, 2019 23:17
Show Gist options
  • Save fuji246/361bb943d40be2efcf9f232ebf178d74 to your computer and use it in GitHub Desktop.
Save fuji246/361bb943d40be2efcf9f232ebf178d74 to your computer and use it in GitHub Desktop.
wget https://github.com/nginx/nginx/archive/branches/stable-1.16.zip
git clone https://github.com/arut/nginx-rtmp-module.git
unzip stable-1.16.zip
cd nginx-branches-stable-1.16/
sudo apt-get install zlib-devel libssl-dev
./auto/configure --with-http_ssl_module --without-http_rewrite_module --add-module=../nginx-rtmp-module
make
sudo make install

sudo cat /usr/local/nginx/conf/nginx.conf

#user  nobody;
worker_processes  1;

#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;
}

rtmp {
        server {
                listen 1935;
                chunk_size 4096;

                application live {
                        live on;
                        hls on;
                        hls_path /tmp/hls;
                        record off;
                }
        }
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #access_log  logs/host.access.log  main;

        location / {
            #root   html;
            #index  index.html index.htm;
            root /home/user/Downloads/p2p-media-loader/p2p-media-loader-demo;
            index index.html;
        }

        location /hls {
            # Serve HLS fragments
            types {
                application/vnd.apple.mpegurl m3u8;
                video/mp2t ts;
            }
            root /tmp;
            add_header Cache-Control no-cache;
        }

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment