forked from alvyl/nginx-module-vts-shared-library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupgrade-nginx.sh
49 lines (26 loc) · 839 Bytes
/
upgrade-nginx.sh
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
# Setup a build directory
mkdir ~/nginx-build && cd ~/nginx-build
# Backup nginx config files
BACKUP_DIR = /etc/nginx-backup`date -I`
sudo mkdir $BACKUP_DIR
sudo cp -r /etc/nginx/* $BACKUP_DIR
# Note down nginx version and details
nginx -V
# Install utils to manage apt sources
sudo apt install software-properties-common
# Add nginx package signing key
wget http://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key
# Add nginx package sources
. /etc/os-release
sudo add-apt-repository 'deb http://nginx.org/packages/mainline/ubuntu/ $UBUNTU_CODENAME nginx'
# Stop nginx
sudo service nginx stop
# Update and install nginx
sudo apt update
sudo apt install ngnix
## Select 'N' (No) for overwrite /etc/nginx/nginx.conf
# Start nginx
sudo service nginx start
# Verify latest nginx version
nginx -V