-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconf.bash
123 lines (123 loc) · 2.96 KB
/
conf.bash
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
function main_menu {
clear
echo "##### Main Menu #####"
echo "1. Nginx Configuration"
echo "2. PHP Configuration"
echo "3. Exit"
echo
echo -n "Enter your choice [1-3]: "
read choice
case $choice in
1) nginx_menu;;
2) php_menu;;
3) exit 0;;
*) echo -e "\nInvalid option. Try again."; sleep 2; main_menu;;
esac
}
function nginx_menu {
clear
echo "##### Nginx Configuration #####"
echo "1. View current Nginx configuration"
echo "2. Edit Nginx configuration"
echo "3. Edit existing domain"
echo "4. Restart Nginx service"
echo "5. Back to Main Menu"
echo
echo -n "Enter your choice [1-5]: "
read choice
case $choice in
1) view_nginx_config;;
2) edit_nginx_config;;
3) edit_domain;;
4) restart_nginx;;
5) main_menu;;
*) echo -e "\nInvalid option. Try again."; sleep 2; nginx_menu;;
esac
}
function php_menu {
clear
echo "##### PHP Configuration #####"
echo "1. View current PHP configuration"
echo "2. Edit PHP configuration"
echo "3. Restart PHP service"
echo "4. Back to Main Menu"
echo
echo -n "Enter your choice [1-4]: "
read choice
case $choice in
1) view_php_config;;
2) edit_php_config;;
3) restart_php;;
4) main_menu;;
*) echo -e "\nInvalid option. Try again."; sleep 2; php_menu;;
esac
}
function view_nginx_config {
clear
echo "##### Nginx Configuration #####"
echo
cat /etc/nginx/nginx.conf
echo
echo -n "Press any key to continue..."
read
nginx_menu
}
function edit_nginx_config {
clear
echo "##### Nginx Configuration #####"
echo
nano /etc/nginx/nginx.conf
nginx_menu
}
function restart_nginx {
clear
echo "##### Nginx Configuration #####"
echo
sudo service nginx restart
echo
echo "Nginx service has been restarted."
echo -n "Press any key to continue..."
read
nginx_menu
}
function edit_domain {
clear
echo "##### Edit Domain Configuration #####"
echo
echo -n "Enter the domain name: "
read domain_name
sudo nano /etc/nginx/sites-enabled/$domain_name
nginx_menu
}
function view_php_config {
clear
echo "##### PHP Configuration #####"
echo
php --ini
echo
echo -n "Press any key to continue..."
read
php_menu
}
function edit_php_config {
clear
echo "##### PHP Configuration #####"
echo
nano $(php --ini | grep "Loaded Configuration File" | awk '{print $4}')
php_menu
}
function restart_php {
clear
echo "##### PHP Configuration #####"
echo
echo -n "Enter PHP Version: "
read phpv
sudo service php$phpv-fpm restart
echo
echo "PHP service has been restarted."
echo -n "Press any key to continue..."
read
php_menu
}
main_menu