Skip to content

Commit 2f9fe66

Browse files
committed
[Added] Added webp lib installation
1 parent 23f427b commit 2f9fe66

File tree

2 files changed

+50
-44
lines changed

2 files changed

+50
-44
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Installation of the following image optimisation libraries:
5050
- optipng
5151
- pngcrush
5252
- pngquant
53+
- webp
5354

5455
#### Password Protect
5556
Ability to add Auth Basic to apps with in serverpilot. This is setup within the nginx app config so will work with both people using nginx + apache and nginx only
@@ -67,6 +68,7 @@ Adds in an Nginx config containing expires headers. The [config file](https://gi
6768
- [x] pngcrush
6869
- [x] pngquant
6970
- [x] gisicle
71+
- [x] webp
7072
- [ ] MariaDB Installation
7173
- [x] Password protect apps
7274
- [x] Nginx expires config

serverpilot-scripts.sh

+48-44
Original file line numberDiff line numberDiff line change
@@ -71,39 +71,39 @@ fi
7171

7272
if [ "$lemp" = "y" ] || [ $run_all = true ]; then
7373
show_notice "Creating LEMP Stack..."
74-
74+
7575
echo -n "What is the appname? : "
7676
read appname
77-
77+
7878
sysuser_default="serverpilot"
7979
echo -n "What is the system user (normally serverpilot)? [default: serverpilot] : "
8080
read sysuser
8181
system_user="${sysuser:-$sysuser_default}"
8282
if [ -n "$appname" ] && [ -n "$system_user" ] && [ -e "/etc/nginx-sp/vhosts.d/${appname}.d" ]; then
83-
83+
8484
app_vhost_dir="/etc/nginx-sp/vhosts.d/${appname}.d"
85-
85+
8686
if [[ -e "${app_vhost_dir}/main.custom.conf" ]]; then
8787
show_warning "${appname} has already been customised. Skipping.."
8888
else
8989
show_info "Backing up main conf file..."
9090
(eval "mv ${app_vhost_dir}/main.conf ${app_vhost_dir}/main.conf.bak")
91-
91+
9292
show_info "Creating new nginx conf..."
9393
(eval "wget --no-cache -O ${app_vhost_dir}/main.custom.conf ${nginx_conf_url}")
94-
94+
9595
show_info "Inserting system user and appanme"
9696
(eval "sed -i -e 's/SYSUSER/${system_user}/g' ${app_vhost_dir}/main.custom.conf")
9797
(eval "sed -i -e 's/APPNAME/${appname}/g' ${app_vhost_dir}/main.custom.conf")
98-
98+
9999
show_info "Restarting nginx..."
100100
service nginx-sp restart
101101
fi
102-
102+
103103
else
104104
show_error "You must provide a valid appname"
105105
fi
106-
106+
107107
show_notice "Finished Creating LEMP Stack..."
108108
fi
109109
# === /LEMP Stack ===
@@ -117,20 +117,20 @@ fi
117117
if [ "$imagick" = "y" ] || [ $run_all = true ]; then
118118
show_notice "Installing Imagick..."
119119
show_info "When asked for a prefix simply press enter."
120-
120+
121121
show_info "Installing Pacakges..."
122122
apt-get install -y gcc make autoconf libc-dev pkg-config
123123
apt-get install -y libmagickwand-dev
124-
124+
125125
show_info "Pecl Installing Imagick..."
126126
(eval "pecl${php_version}-sp install imagick")
127-
127+
128128
show_info "Enabling Imagick Extension..."
129129
bash -c "echo extension=imagick.so > /etc/php${php_version}-sp/conf.d/imagick.ini"
130-
130+
131131
show_info "Restarting PHP FPM..."
132132
(eval "service php${php_version}-fpm-sp restart")
133-
133+
134134
show_notice "Finished Installing Imagick..."
135135
fi
136136
# === /Imagick ===
@@ -143,9 +143,9 @@ fi
143143

144144
if [ "$automysqlbackup" = "y" ] || [ $run_all = true ]; then
145145
show_notice "Installing AutoMySQLBackup..."
146-
146+
147147
apt-get install -y automysqlbackup
148-
148+
149149
show_notice "Finished Installing AutoMySQLBackup..."
150150
fi
151151
# === /AutoMySQLBackup ===
@@ -158,7 +158,7 @@ fi
158158

159159
if [ "$mysql_strict" = "y" ] || [ $run_all = true ]; then
160160
show_notice "Disabling MySQL Strict Mode..."
161-
161+
162162
if [ -e /etc/mysql/conf.d/disable_strict_mode.cnf ]; then
163163
show_info "Disable strict mode config already exists"
164164
else
@@ -169,7 +169,7 @@ if [ "$mysql_strict" = "y" ] || [ $run_all = true ]; then
169169
show_info "Restarting MySql..."
170170
service mysql restart
171171
fi
172-
172+
173173
show_notice "Finished Disabling MySQL Strict Mode..."
174174
fi
175175
# === /Disable MySQL 5.7 Strict Mode ===
@@ -182,27 +182,31 @@ fi
182182

183183
if [ "$imgopt" = "y" ] || [ $run_all = true ]; then
184184
show_notice "Installing image optimisation libraries..."
185-
185+
186186
# jpegoptim
187187
show_info "Installing jpegoptim..."
188188
apt-get install -y jpegoptim
189189

190190
# optipng
191191
show_info "Installing optipng..."
192192
apt-get install -y optipng
193-
193+
194194
# pngquant
195195
show_info "Installing pngquant..."
196196
apt-get install -y pngquant
197-
197+
198198
# pngcrush
199199
show_info "Installing pngcrush..."
200200
apt-get install -y pngcrush
201-
201+
202202
# gifsicle
203203
show_info "Installing gifsicle..."
204204
apt-get install -y gifsicle
205-
205+
206+
# webp
207+
show_info "Installing webp..."
208+
apt-get install -y webp
209+
206210
show_notice "Finished Installing image optimisation libraries..."
207211
fi
208212
# === /Image optimisation libraries ===
@@ -215,62 +219,62 @@ fi
215219

216220
if [ "$pwd_protect" = "y" ] || [ $run_all = true ]; then
217221
show_notice "Starting Password protect app process..."
218-
222+
219223
echo -n "What is the appname of the app you would like to password? :"
220224
read appname
221-
225+
222226
if [ -n "$appname" ] && [ -e "/etc/nginx-sp/vhosts.d/${appname}.d" ]; then
223-
227+
224228
# Get System User (normall "severpilot")
225229
system_user_default="serverpilot"
226230
echo -n "System user, the user from serverpilot that controls the app: [default: serverpilot]"
227231
read system_user_input
228232
system_user="${system_user_input:-$system_user_default}"
229-
233+
230234
# Get Title
231235
pwd_title_default="Restricted Content"
232236
echo -n "Title for password protect? [default: ${pwd_title_default}] "
233237
read pwd_title_input
234238
pwd_title="${pwd_title_input:-$pwd_title_default}"
235-
239+
236240
# Get Username
237241
echo -n "Username: "
238242
read pwd_username
239243
if [[ ! -n "$pwd_username" ]]; then
240244
show_error "You must supply a username"
241245
fi
242-
246+
243247
# Create password file
244248
show_info "Creating password file..."
245249
pwd_dir="/srv/users/${system_user}/pwd/${appname}"
246250
mkdir -p "${pwd_dir}"
247251
pwd_path="${pwd_dir}/.htpasswd"
248-
252+
249253
if [[ ! -e "${pwd_path}" ]]; then
250254
touch "${pwd_path}"
251255
fi
252-
256+
253257
# Generate user / pass
254258
(eval "htpasswd ${pwd_path} ${pwd_username}")
255-
259+
256260
nginx_pwd_conf="/etc/nginx-sp/vhosts.d/${appname}.d/password.conf"
257261
if [[ ! -e "${nginx_pwd_conf}" ]]; then
258262
show_info "Creating nginx password conf file..."
259-
263+
260264
auth_basic='auth_basic "'"${pwd_title}"'";'
261265
auth_basic_user_file="auth_basic_user_file ${pwd_path};"
262-
266+
263267
touch "${nginx_pwd_conf}"
264268
(echo $auth_basic >> $nginx_pwd_conf)
265269
(eval "echo \"${auth_basic_user_file}\" >> ${nginx_pwd_conf}")
266270
fi
267-
271+
268272
service nginx-sp restart
269-
273+
270274
else
271275
show_info "${appname} not found."
272276
fi
273-
277+
274278
show_notice "Finished Password protect app process..."
275279
fi
276280
# === /Password Protect App ===
@@ -283,29 +287,29 @@ fi
283287

284288
if [ "$expires_nginx" = "y" ] || [ $run_all = true ]; then
285289
show_notice "Adding Expires Nginx Conf..."
286-
290+
287291
echo -n "What is the appname? : "
288292
read appname
289293
if [ -n "$appname" ] && [ -e "/etc/nginx-sp/vhosts.d/${appname}.d" ]; then
290-
294+
291295
app_vhost_dir="/etc/nginx-sp/vhosts.d/${appname}.d"
292296
expires_conf_file="${app_vhost_dir}/expires.conf"
293-
297+
294298
if [[ -e "${expires_conf_filre}" ]]; then
295299
show_warning "${appname} already has expires file. Skipping.."
296300
else
297-
301+
298302
show_info "Creating expires nginx conf..."
299303
(eval "wget --no-cache -O ${expires_conf_file} ${nginx_expires_conf_url}")
300-
304+
301305
show_info "Restarting nginx..."
302306
service nginx-sp restart
303307
fi
304-
308+
305309
else
306310
show_error "You must provide a valid appname"
307311
fi
308-
312+
309313
show_notice "Finished Adding Expires Nginx Conf..."
310314
fi
311315
# === /Expires Nginx Conf ===

0 commit comments

Comments
 (0)