wordpress_install/updated_install2.sh

23 lines
940 B
Bash

#!/bin/bash
# ====== CONFIGURATION ======
DB_PASSWORD="changeme123" # <- Set your database password here
# ============================
# Create wp-config.php from the sample
sudo -u www-data cp /srv/www/wordpress/wp-config-sample.php /srv/www/wordpress/wp-config.php
# Replace database settings
sudo -u www-data sed -i 's/database_name_here/wordpress/' /srv/www/wordpress/wp-config.php
sudo -u www-data sed -i 's/username_here/wordpress/' /srv/www/wordpress/wp-config.php
sudo -u www-data sed -i "s/password_here/${DB_PASSWORD}/" /srv/www/wordpress/wp-config.php
# Path to config
WP_CONFIG="/srv/www/wordpress/wp-config.php"
# Delete existing placeholder salts
sed -i "/AUTH_KEY/d;/SECURE_AUTH_KEY/d;/LOGGED_IN_KEY/d;/NONCE_KEY/d;/AUTH_SALT/d;/SECURE_AUTH_SALT/d;/LOGGED_IN_SALT/d;/NONCE_SALT/d" "$WP_CONFIG"
# Fetch and append new salts from the WordPress API
curl -s https://api.wordpress.org/secret-key/1.1/salt/ >> "$WP_CONFIG"