Add updated_install2.sh

This commit is contained in:
RomanNum3ral 2025-05-28 23:17:35 +00:00
parent 61eec19f41
commit b3c6f9972f
1 changed files with 22 additions and 0 deletions

22
updated_install2.sh Normal file
View File

@ -0,0 +1,22 @@
#!/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"