forked from cpwc/le-serverpilot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsp-no-https.sh
More file actions
83 lines (67 loc) · 2.85 KB
/
Copy pathsp-no-https.sh
File metadata and controls
83 lines (67 loc) · 2.85 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# HTTPS add into Serverpilot
RED='\033[0;31m'
NC='\033[0m' # No Color
GREEN='\033[0;32m'
#==
echo -e "${RED}"
echo -e ""
echo -e " ###############################################################"
echo -e " ## THIS WILL REMOVE THE CUSTOM VHOST FOR SERVERPILOT ##"
echo -e " ## ##"
echo -e " ## ${NC}** USE AT YOUR OWN RISK **${RED} ##"
echo -e " ## ##"
echo -e " ###############################################################"
echo -e "${NC}"
echo "Do you want to remove the custom conf file for HTTPS (y/n)?"
echo -e "${RED} ** this cannot be undone **${NC}"
echo ""
read DFRUN
if [[ "${DFRUN}" == "y" ]]; then
echo "What is your current app name?"
echo ""
read MYAPP
# Check whether the app exists
# Lets check if a custom conf exists
MYAPP_FILE="${DF_CL_NGINX}/${MYAPP}.ssl.conf"
if [[ ! -f ${MYAPP_FILE} ]]; then
echo -e "${RED}ERROR:${NC} NGINX CUSTOM CONFIG NOT FOUND";
echo" - Check your spelling and try again";
echo " you may have not setup a ssl config yet";
exit 1;
fi
# Remove the custom files
# START WITH NGINX-SP
sudo rm -f -- "${MYAPP_FILE}"
echo " + Custom Nginx Conf Removed for (${MYAPP})"
# Lets check if a custom conf exists
MYAPP_FILE="${DF_CL_APACHE}/${MYAPP}.custom.conf"
if [[ ! -f ${MYAPP_FILE} ]]; then
echo -e "${RED}ERROR:${NC} APACHE SSL CONFIG NOT FOUND";
echo" - Check your spelling and try again";
echo " you may have not setup a ssl config yet";
exit 1;
fi
# APACHE-SP
sudo rm -f -- "${MYAPP_FILE}"
echo " + Custom APACHE Conf Removed for (${MYAPP})"
# Remove the HTTPS ONLY REDIRECT if it exists
if [[ ! -f "${DF_CL_NGINX}/${MYAPP}.d/redirect.nonssl_conf" ]]; then
sudo rm -f -- "${DF_CL_NGINX}/${MYAPP}.d/redirect.nonssl_conf"
echo " + Removed SSL ONLY Redirect"
fi
#ALL DONE, Lets restart both services
echo -e "Do you want to ${RED}RESTART${NC} NGINX service (y/n)?"
echo " - this is needed to turn off SSL"
read DFRUNR
if [ "${DFRUNR}" == "y" ]; then
sudo service nginx-sp restart
sudo service apache-sp restart
echo -e " ${GREEN}+ DONE${NC}"
exit;
else
echo "No services restarted, config files have been removed"
echo "your nginx & apache service needs to be restarted in order for the changes to reflected"
fi
else
echo -e "Keep SSL? Left the conf files alone!"
fi