forked from jtangelder/dokku-nginx-alt
-
Notifications
You must be signed in to change notification settings - Fork 2
/
install
executable file
·25 lines (19 loc) · 823 Bytes
/
install
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
#!/usr/bin/env bash
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
# latest stable NGINX 1.4.x with websocket support
add-apt-repository -y ppa:nginx/stable
apt-get update
apt-get install -y nginx dnsutils
if ! grep -q dokku-nginx-reload "/etc/sudoers"; then
touch /etc/sudoers.tmp
cp /etc/sudoers /tmp/sudoers.new
echo "%dokku ALL=(ALL)NOPASSWD:/etc/init.d/nginx reload # dokku-nginx-reload" >> /tmp/sudoers.new
EDITOR="cp /tmp/sudoers.new" visudo
rm /tmp/sudoers.new
fi
echo "include $DOKKU_ROOT/*/nginx.conf;" > /etc/nginx/conf.d/dokku.conf
sed -i 's/# server_names_hash_bucket_size/server_names_hash_bucket_size/' /etc/nginx/nginx.conf
if [[ ! -f "$DOKKU_ROOT/VHOST" ]]; then
[[ $(dig +short $(< "$DOKKU_ROOT/HOSTNAME")) ]] && cp "$DOKKU_ROOT/HOSTNAME" "$DOKKU_ROOT/VHOST"
fi
/etc/init.d/nginx start