-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
62 lines (46 loc) · 1.45 KB
/
build.sh
File metadata and controls
62 lines (46 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
# This script configures an Ubuntu system with NGINX rtmp streaming. Note this script makes changes to your machine configuration.
# Use with care and backup any important data or configs before running.
set -euo pipefail
IFS=$'\n\t'
export DEBIAN_FRONTEND=noninteractive
ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime
apt-get update -y
apt-get install -y sudo
sudo apt-get install -y \
git \
build-essential \
ffmpeg \
libpcre3-dev \
libssl-dev \
zlib1g-dev \
git clone https://github.com/arut/nginx-rtmp-module.git
git clone https://github.com/nginx/nginx.git
pushd nginx
./auto/configure \
--add-module=../nginx-rtmp-module \
--with-http_ssl_module --with-cc-opt="-Wimplicit-fallthrough=0"
make
sudo make install
sudo /usr/local/nginx/sbin/nginx -v
popd
# TODO: see if file exists first
TMPFILE=$(mktemp /tmp/nginx_rtmp_script.XXXXXX)
cat << EOF >> "${TMPFILE}"
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
PIDFile=/var/run/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx -g "pid /var/run/nginx.pid;"
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/bin/kill -s QUIT \$MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
EOF
sudo mv "${TMPFILE}" /etc/systemd/system/nginx.service
sudo systemctl daemon-reload
sudo systemctl restart nginx