August 2, 2015
Compile nginx with RTMP support on Raspbian
Here’s a bash script. Put this into a new file, ~/install-nginx-rtmp.sh:
#!/bin/bash
sudo apt-get update
sudo apt-get install nginx -y
sudo apt-get remove nginx -y
sudo apt-get clean nginx -y
sudo apt-get install -y curl build-essential libpcre3-dev libpcre++-dev zlib1g-dev libcurl4-openssl-dev libssl-dev
mkdir nginx-build
cd nginx-build
wget http://nginx.org/download/nginx-1.7.5.tar.gz
wget https://github.com/arut/nginx-rtmp-module/archive/master.zip
tar -zxvf nginx-1.7.5.tar.gz
unzip master.zip
cd nginx-1.7.5
./configure --prefix=/var/www --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-http_ssl_module --without-http_proxy_module --add-module=/home/pi/nginx-build/nginx-rtmp-module-master
make
sudo make install
echo "made it to the end"
execute it like this:
sh install.sh
Notice it installs nginx from the package manager, and then removes it. This will leave some useful files behind for running nginx as a service.
This script is made of commands I learned from these posts, which explain what’s going on line-by-line.
- Using nginx version suggested by Setup Nginx-RTMP on Ubuntu 14.04 @ Vultr
- Using the package manager’s nginx init files & configuration flags came from Live video stream from the Raspberry Pi using nginx and rtmp-module