Last active
March 24, 2017 07:16
-
-
Save hirokazumiyaji/9f0711b5b4b2a105db470ea98592b715 to your computer and use it in GitHub Desktop.
rtmp nginx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:16.04 | |
RUN apt-get -y update | |
RUN apt-get install -y wget gcc g++ make libpcre3 libpcre3-dev openssl libssl-dev sudo ffmpeg | |
RUN mkdir -p /var/nginx/modules | |
RUN cd /tmp && wget https://github.com/cubicdaiya/nginx-build/releases/download/v0.9.15/nginx-build-linux-amd64-0.9.15.tar.gz | |
RUN cd /tmp && tar xzf nginx-build-linux-amd64-0.9.15.tar.gz | |
RUN mv /tmp/nginx-build /usr/local/bin | |
RUN cd /tmp && wget https://github.com/arut/nginx-rtmp-module/archive/v1.1.11.tar.gz | |
RUN cd /tmp && tar xzf v1.1.11.tar.gz | |
RUN mv /tmp/nginx-rtmp-module-1.1.11 /var/nginx/modules | |
RUN nginx-build -d /tmp/work \ | |
--sbin-path=/usr/sbin/nginx \ | |
--conf-path=/etc/nginx/nginx.conf \ | |
--error-log-path=/var/log/nginx/error.log \ | |
--pid-path=/var/run/nginx.pid \ | |
--lock-path=/var/lock/nginx.lock \ | |
--http-log-path=/var/log/nginx/access.log \ | |
--http-client-body-temp-path=/var/lib/nginx/body \ | |
--http-proxy-temp-path=/var/lib/nginx/proxy \ | |
--with-http_stub_status_module \ | |
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \ | |
--with-debug \ | |
--with-http_gzip_static_module \ | |
--with-http_v2_module \ | |
--with-http_ssl_module \ | |
--with-pcre-jit \ | |
--add-module=/var/nginx/modules/nginx-rtmp-module-1.1.11 \ | |
--with-http_ssl_module | |
RUN cd /tmp/work/nginx/1.11.11/nginx-1.11.11 && make install | |
RUN mkdir -p /var/log/nginx/hls /var/lib/nginx/body /var/lib/nginx/proxy /var/lib/nginx/fastcgi | |
ADD nginx.conf /etc/nginx/nginx.conf | |
CMD ["/usr/sbin/nginx", "-g", "daemon off;"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
worker_processes 1; | |
events { | |
worker_connections 1024; | |
} | |
rtmp { | |
server { | |
listen 1935; | |
chunk_size 4000; | |
application live { | |
live on; | |
hls on; | |
record all; | |
hls_path /var/log/nginx/hls; | |
hls_fragment 1s; | |
hls_type live; | |
} | |
} | |
} | |
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 /var/log/nginx/access.log main; | |
sendfile on; | |
keepalive_timeout 65; | |
server { | |
listen 80; | |
server_name localhost; | |
access_log /var/log/nginx/access.log main; | |
location /live { | |
types { | |
application/vnd.apple.mpegurl m3u8; | |
video/mp2t ts; | |
} | |
root /var/log/nginx/hls; | |
add_header Cache-Control no-cache; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment