Skip to content

Commit ddb04ee

Browse files
author
Daniel Hansson
authored
fix db issues (#11)
1 parent 0498db1 commit ddb04ee

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

wordpress_install.sh

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,12 @@ check_command wp core download --allow-root --force --debug --path="$WPATH"
248248

249249
# Populate DB
250250
mysql -uroot -p"$MARIADB_PASS" <<MYSQL_SCRIPT
251-
CREATE DATABASE "$WPDBNAME";
251+
CREATE DATABASE $WPDBNAME;
252252
CREATE USER '$WPDBUSER'@'localhost' IDENTIFIED BY '$WPDBPASS';
253-
GRANT ALL PRIVILEGES ON "$WPDBNAME".* TO '$WPDBUSER'@'localhost';
253+
GRANT ALL PRIVILEGES ON $WPDBNAME.* TO '$WPDBUSER'@'localhost';
254254
FLUSH PRIVILEGES;
255255
MYSQL_SCRIPT
256-
wp core config --allow-root --dbname="$WPDBNAME" --dbuser="$WPDBUSER" --dbpass="$WPDBPASS" --dbhost=localhost --extra-php <<PHP
256+
wp core config --allow-root --dbname=$WPDBNAME --dbuser=$WPDBUSER --dbpass="$WPDBPASS" --dbhost=localhost --extra-php <<PHP
257257
define( 'WP_DEBUG', false );
258258
define( 'WP_CACHE_KEY_SALT', 'wpredis_' );
259259
define( 'WP_REDIS_MAXTTL', 9600);
@@ -267,15 +267,15 @@ echo "Wordpress DB: $WPDBPASS"
267267
} >> "$MYCNF"
268268

269269
# Install Wordpress
270-
check_command wp core install --allow-root --url="http://$ADDRESS/" --title=Wordpress --admin_user="$WPADMINUSER" --admin_password="$WPADMINPASS" [email protected] --skip-email
270+
check_command wp core install --allow-root --url=http://"$ADDRESS"/ --title=Wordpress --admin_user=$WPADMINUSER --admin_password="$WPADMINPASS" [email protected] --skip-email
271271
echo "WP PASS: $WPADMINPASS" > /var/adminpass.txt
272272
chown wordpress:wordpress /var/adminpass.txt
273273

274274
# Create welcome post
275-
check_command wget -q "$STATIC/welcome.txt"
275+
check_command wget -q $STATIC/welcome.txt
276276
sed -i "s|wordpress_user_login|$WPADMINUSER|g" welcome.txt
277277
sed -i "s|wordpress_password_login|$WPADMINPASS|g" welcome.txt
278-
wp post create ./welcome.txt --post_title='Tech and Me - Welcome' --post_status=publish --path="$WPATH" --allow-root
278+
wp post create ./welcome.txt --post_title='Tech and Me - Welcome' --post_status=publish --path=$WPATH --allow-root
279279
rm -f welcome.txt
280280
wp post delete 1 --force --allow-root
281281

@@ -303,7 +303,7 @@ run_static_script wp-permissions
303303

304304
# Hardening security
305305
# create .htaccess to protect uploads directory
306-
cat > "$WPATH/wp-content/uploads/.htaccess" <<'EOL'
306+
cat > $WPATH/wp-content/uploads/.htaccess <<'EOL'
307307
# Protect this file
308308
<Files .htaccess>
309309
Order Deny,Allow
@@ -334,10 +334,10 @@ sed -i "s|upload_max_filesize =.*|upload_max_filesize = 1000M|g" /etc/php/7.0/ap
334334
apt install figlet -y
335335

336336
# Generate $SSL_CONF
337-
if [ ! -f "$SSL_CONF" ];
337+
if [ ! -f $SSL_CONF ];
338338
then
339-
touch "$SSL_CONF"
340-
cat << SSL_CREATE > "$SSL_CONF"
339+
touch $SSL_CONF
340+
cat << SSL_CREATE > $SSL_CONF
341341
<VirtualHost *:443>
342342
Header add Strict-Transport-Security: "max-age=15768000;includeSubdomains"
343343
SSLEngine on
@@ -348,15 +348,15 @@ if [ ! -f "$SSL_CONF" ];
348348
# ServerAlias www.example.com
349349
350350
### SETTINGS ###
351-
DocumentRoot "$WPATH"
352-
<Directory "$WPATH">
351+
DocumentRoot $WPATH
352+
<Directory $WPATH>
353353
Options Indexes FollowSymLinks MultiViews
354354
AllowOverride All
355355
Require all granted
356356
</Directory>
357357
358-
SetEnv HOME "$WPATH"
359-
SetEnv HTTP_HOME "$WPATH"
358+
SetEnv HOME $WPATH
359+
SetEnv HTTP_HOME $WPATH
360360
361361
### LOCATION OF CERT FILES ###
362362
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
@@ -374,10 +374,10 @@ sleep 3
374374
fi
375375

376376
# Generate $HTTP_CONF
377-
if [ ! -f "$HTTP_CONF" ];
377+
if [ ! -f $HTTP_CONF ];
378378
then
379-
touch "$HTTP_CONF"
380-
cat << HTTP_CREATE > "$HTTP_CONF"
379+
touch $HTTP_CONF
380+
cat << HTTP_CREATE > $HTTP_CONF
381381
382382
<VirtualHost *:80>
383383
@@ -387,8 +387,8 @@ if [ ! -f "$HTTP_CONF" ];
387387
# ServerAlias www.example.com
388388
389389
### SETTINGS ###
390-
DocumentRoot "$WPATH"
391-
<Directory "$WPATH">
390+
DocumentRoot $WPATH
391+
<Directory $WPATH>
392392
Options Indexes FollowSymLinks MultiViews
393393
AllowOverride All
394394
Require all granted

0 commit comments

Comments
 (0)