-
Notifications
You must be signed in to change notification settings - Fork 3
/
nginx-php.sh
executable file
·108 lines (72 loc) · 2.46 KB
/
nginx-php.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
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
#!/bin/bash
if [ $UID -ne 0 ] ; then
echo " 403 Error !!. Please run me as root"
exit
fi
echo "#################################################################################################################"
echo "# #"
echo "# Welcome!! This script will install php-backend eviroment #"
echo "# #"
echo "#################################################################################################################"
echo -e "\n\n\n"
echo " Updating System files... "
echo -e "\n\n\n"
apt-get update -y
echo -e "\n\n\n"
echo " Done Updating... "
echo -e "\n\n\n";
echo " Installing Apache... "
# Install nginx
apt-get install nginx -y
apt-get install nginx-extras -y
wget https://raw.githubusercontent.com/sagespidy/Apache2/master/nginx-php.conf
mv nginx-php.conf default
mv default /etc/nginx/sites-enabled/default
echo -e "\n\n\n"
echo " Nginx Installed "
echo -e "\n\n\n"
echo " Installing PHP 7..."
echo -e "\n\n\n"
#install php7
apt-get -y install php7.0*
apt-get remove php7.0-snmp -y
echo -e "\n\n\n"
echo " PHP 7 Installed. "
echo -e "\n\n\n"
echo -e "\n\n\n"
echo " Installing MySql Client... "
echo -e "\n\n\n"
# install MySql
apt-get install -y mysql-client
echo -e "\n\n\n"
echo " Mysql client installed"
echo -e "\n\n\n"
echo " Apache Restarted"
echo -e " \n\n\n "
echo -e "\n\n\n\n\n\n"
echo -e "\n\n\n\n\n\n"
echo "Creating a New User...."
echo -e " \n\n\n "
echo " Please enter the name of user: "
# Take input from user
usr_name=sportsstar
# Create a directory for user
mkdir -p /var/www/html/
# Make a new user and set his Password
useradd $usr_name -d /var/www/html -s /bin/bash
chown -R $usr_name:$usr_name /var/www/html/
echo "$usr_name:$usr_name-%^(*)%$&^gjvgtyyi7675"|chpasswd
# Enable SSH login
sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
service ssh restart
echo -e "\n\n\n\n\n\n"
echo -e "\n\n\n\n\n\n"
echo "SSH via Password Authentication enabled"
echo "$usr_name ALL=NOPASSWD:ALL #Sudo rights for $usr_name " >>/etc/sudoers
echo "Sudo rights to $usr_name has been been provided with NOPASSWD Authentication"
echo -e "\n\n\n\n\n\n"
echo "Synchronizing System Time"
apt-get install -y ntp
apt-get install -y htop ncdu zip unzip
echo -e "\n\n\n\n\n\n"
echo -e "\n\n\n\n\n\n"