From 12baf3a68e05f1f28a7dd9432812ccbebb2aa71a Mon Sep 17 00:00:00 2001 From: RomanNum3ral Date: Thu, 29 May 2025 01:49:19 +0000 Subject: [PATCH] Update updated_install1.sh --- updated_install1.sh | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/updated_install1.sh b/updated_install1.sh index eba8b6a..efafde8 100644 --- a/updated_install1.sh +++ b/updated_install1.sh @@ -1,8 +1,7 @@ #!/bin/bash # ====== CONFIGURATION ====== -HOSTNAME="wordpress.local" -IP="127.0.0.1" +HOSTNAME="10.28.24.47" # IP-based access SITE_CONF="/etc/apache2/sites-available/wordpress.conf" WEB_ROOT="/srv/www/wordpress" DB_PASSWORD="changeme123" @@ -38,11 +37,6 @@ cat << EOF | sudo tee "$SITE_CONF" > /dev/null EOF -# Add hostname to /etc/hosts if not already present -if ! grep -q "$HOSTNAME" /etc/hosts; then - echo "$IP $HOSTNAME" | sudo tee -a /etc/hosts > /dev/null -fi - # Enable site and modules, disable default a2ensite wordpress.conf a2enmod rewrite @@ -55,6 +49,10 @@ CREATE DATABASE IF NOT EXISTS wordpress; CREATE USER IF NOT EXISTS 'wordpress'@'localhost' IDENTIFIED BY '$DB_PASSWORD'; GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER ON wordpress.* TO 'wordpress'@'localhost'; FLUSH PRIVILEGES; +-- Update WordPress site URLs +USE wordpress; +UPDATE wp_options SET option_value = 'http://$HOSTNAME' WHERE option_name = 'siteurl'; +UPDATE wp_options SET option_value = 'http://$HOSTNAME' WHERE option_name = 'home'; EOF # Create wp-config.php from the sample