Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Commit 898b561

Browse files
author
Daryl Lozupone
committed
Add command to switch between Nginx and Apache
closes wplib/wplib-box#186
1 parent 55d80ba commit 898b561

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

guest/cli/commands/set-web-server

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
3+
echo "Switching web server to $1"
4+
5+
if [ ! "apache" == "$1" ] && [ ! "nginx" == "$1" ]; then
6+
echo 'You must select either nginx or apache'
7+
exit 1
8+
fi
9+
10+
converse="apache"
11+
if [ 'apache' == $1 ]; then
12+
converse='nginx'
13+
fi
14+
15+
sudo sed -i "s/${converse}/$1/" /etc/supervisor/conf.d/webserver.conf
16+
17+
docker stop ${converse}
18+
docker start $1

0 commit comments

Comments
 (0)