71
71
72
72
if [ " $lemp " = " y" ] || [ $run_all = true ]; then
73
73
show_notice " Creating LEMP Stack..."
74
-
74
+
75
75
echo -n " What is the appname? : "
76
76
read appname
77
-
77
+
78
78
sysuser_default=" serverpilot"
79
79
echo -n " What is the system user (normally serverpilot)? [default: serverpilot] : "
80
80
read sysuser
81
81
system_user=" ${sysuser:- $sysuser_default } "
82
82
if [ -n " $appname " ] && [ -n " $system_user " ] && [ -e " /etc/nginx-sp/vhosts.d/${appname} .d" ]; then
83
-
83
+
84
84
app_vhost_dir=" /etc/nginx-sp/vhosts.d/${appname} .d"
85
-
85
+
86
86
if [[ -e " ${app_vhost_dir} /main.custom.conf" ]]; then
87
87
show_warning " ${appname} has already been customised. Skipping.."
88
88
else
89
89
show_info " Backing up main conf file..."
90
90
(eval " mv ${app_vhost_dir} /main.conf ${app_vhost_dir} /main.conf.bak" )
91
-
91
+
92
92
show_info " Creating new nginx conf..."
93
93
(eval " wget --no-cache -O ${app_vhost_dir} /main.custom.conf ${nginx_conf_url} " )
94
-
94
+
95
95
show_info " Inserting system user and appanme"
96
96
(eval " sed -i -e 's/SYSUSER/${system_user} /g' ${app_vhost_dir} /main.custom.conf" )
97
97
(eval " sed -i -e 's/APPNAME/${appname} /g' ${app_vhost_dir} /main.custom.conf" )
98
-
98
+
99
99
show_info " Restarting nginx..."
100
100
service nginx-sp restart
101
101
fi
102
-
102
+
103
103
else
104
104
show_error " You must provide a valid appname"
105
105
fi
106
-
106
+
107
107
show_notice " Finished Creating LEMP Stack..."
108
108
fi
109
109
# === /LEMP Stack ===
117
117
if [ " $imagick " = " y" ] || [ $run_all = true ]; then
118
118
show_notice " Installing Imagick..."
119
119
show_info " When asked for a prefix simply press enter."
120
-
120
+
121
121
show_info " Installing Pacakges..."
122
122
apt-get install -y gcc make autoconf libc-dev pkg-config
123
123
apt-get install -y libmagickwand-dev
124
-
124
+
125
125
show_info " Pecl Installing Imagick..."
126
126
(eval " pecl${php_version} -sp install imagick" )
127
-
127
+
128
128
show_info " Enabling Imagick Extension..."
129
129
bash -c " echo extension=imagick.so > /etc/php${php_version} -sp/conf.d/imagick.ini"
130
-
130
+
131
131
show_info " Restarting PHP FPM..."
132
132
(eval " service php${php_version} -fpm-sp restart" )
133
-
133
+
134
134
show_notice " Finished Installing Imagick..."
135
135
fi
136
136
# === /Imagick ===
143
143
144
144
if [ " $automysqlbackup " = " y" ] || [ $run_all = true ]; then
145
145
show_notice " Installing AutoMySQLBackup..."
146
-
146
+
147
147
apt-get install -y automysqlbackup
148
-
148
+
149
149
show_notice " Finished Installing AutoMySQLBackup..."
150
150
fi
151
151
# === /AutoMySQLBackup ===
158
158
159
159
if [ " $mysql_strict " = " y" ] || [ $run_all = true ]; then
160
160
show_notice " Disabling MySQL Strict Mode..."
161
-
161
+
162
162
if [ -e /etc/mysql/conf.d/disable_strict_mode.cnf ]; then
163
163
show_info " Disable strict mode config already exists"
164
164
else
@@ -169,7 +169,7 @@ if [ "$mysql_strict" = "y" ] || [ $run_all = true ]; then
169
169
show_info " Restarting MySql..."
170
170
service mysql restart
171
171
fi
172
-
172
+
173
173
show_notice " Finished Disabling MySQL Strict Mode..."
174
174
fi
175
175
# === /Disable MySQL 5.7 Strict Mode ===
182
182
183
183
if [ " $imgopt " = " y" ] || [ $run_all = true ]; then
184
184
show_notice " Installing image optimisation libraries..."
185
-
185
+
186
186
# jpegoptim
187
187
show_info " Installing jpegoptim..."
188
188
apt-get install -y jpegoptim
189
189
190
190
# optipng
191
191
show_info " Installing optipng..."
192
192
apt-get install -y optipng
193
-
193
+
194
194
# pngquant
195
195
show_info " Installing pngquant..."
196
196
apt-get install -y pngquant
197
-
197
+
198
198
# pngcrush
199
199
show_info " Installing pngcrush..."
200
200
apt-get install -y pngcrush
201
-
201
+
202
202
# gifsicle
203
203
show_info " Installing gifsicle..."
204
204
apt-get install -y gifsicle
205
-
205
+
206
+ # webp
207
+ show_info " Installing webp..."
208
+ apt-get install -y webp
209
+
206
210
show_notice " Finished Installing image optimisation libraries..."
207
211
fi
208
212
# === /Image optimisation libraries ===
215
219
216
220
if [ " $pwd_protect " = " y" ] || [ $run_all = true ]; then
217
221
show_notice " Starting Password protect app process..."
218
-
222
+
219
223
echo -n " What is the appname of the app you would like to password? :"
220
224
read appname
221
-
225
+
222
226
if [ -n " $appname " ] && [ -e " /etc/nginx-sp/vhosts.d/${appname} .d" ]; then
223
-
227
+
224
228
# Get System User (normall "severpilot")
225
229
system_user_default=" serverpilot"
226
230
echo -n " System user, the user from serverpilot that controls the app: [default: serverpilot]"
227
231
read system_user_input
228
232
system_user=" ${system_user_input:- $system_user_default } "
229
-
233
+
230
234
# Get Title
231
235
pwd_title_default=" Restricted Content"
232
236
echo -n " Title for password protect? [default: ${pwd_title_default} ] "
233
237
read pwd_title_input
234
238
pwd_title=" ${pwd_title_input:- $pwd_title_default } "
235
-
239
+
236
240
# Get Username
237
241
echo -n " Username: "
238
242
read pwd_username
239
243
if [[ ! -n " $pwd_username " ]]; then
240
244
show_error " You must supply a username"
241
245
fi
242
-
246
+
243
247
# Create password file
244
248
show_info " Creating password file..."
245
249
pwd_dir=" /srv/users/${system_user} /pwd/${appname} "
246
250
mkdir -p " ${pwd_dir} "
247
251
pwd_path=" ${pwd_dir} /.htpasswd"
248
-
252
+
249
253
if [[ ! -e " ${pwd_path} " ]]; then
250
254
touch " ${pwd_path} "
251
255
fi
252
-
256
+
253
257
# Generate user / pass
254
258
(eval " htpasswd ${pwd_path} ${pwd_username} " )
255
-
259
+
256
260
nginx_pwd_conf=" /etc/nginx-sp/vhosts.d/${appname} .d/password.conf"
257
261
if [[ ! -e " ${nginx_pwd_conf} " ]]; then
258
262
show_info " Creating nginx password conf file..."
259
-
263
+
260
264
auth_basic=' auth_basic "' " ${pwd_title} " ' ";'
261
265
auth_basic_user_file=" auth_basic_user_file ${pwd_path} ;"
262
-
266
+
263
267
touch " ${nginx_pwd_conf} "
264
268
(echo $auth_basic >> $nginx_pwd_conf )
265
269
(eval " echo \" ${auth_basic_user_file} \" >> ${nginx_pwd_conf} " )
266
270
fi
267
-
271
+
268
272
service nginx-sp restart
269
-
273
+
270
274
else
271
275
show_info " ${appname} not found."
272
276
fi
273
-
277
+
274
278
show_notice " Finished Password protect app process..."
275
279
fi
276
280
# === /Password Protect App ===
283
287
284
288
if [ " $expires_nginx " = " y" ] || [ $run_all = true ]; then
285
289
show_notice " Adding Expires Nginx Conf..."
286
-
290
+
287
291
echo -n " What is the appname? : "
288
292
read appname
289
293
if [ -n " $appname " ] && [ -e " /etc/nginx-sp/vhosts.d/${appname} .d" ]; then
290
-
294
+
291
295
app_vhost_dir=" /etc/nginx-sp/vhosts.d/${appname} .d"
292
296
expires_conf_file=" ${app_vhost_dir} /expires.conf"
293
-
297
+
294
298
if [[ -e " ${expires_conf_filre} " ]]; then
295
299
show_warning " ${appname} already has expires file. Skipping.."
296
300
else
297
-
301
+
298
302
show_info " Creating expires nginx conf..."
299
303
(eval " wget --no-cache -O ${expires_conf_file} ${nginx_expires_conf_url} " )
300
-
304
+
301
305
show_info " Restarting nginx..."
302
306
service nginx-sp restart
303
307
fi
304
-
308
+
305
309
else
306
310
show_error " You must provide a valid appname"
307
311
fi
308
-
312
+
309
313
show_notice " Finished Adding Expires Nginx Conf..."
310
314
fi
311
315
# === /Expires Nginx Conf ===
0 commit comments