Update updated_install1.sh

This commit is contained in:
RomanNum3ral 2025-05-29 01:49:19 +00:00
parent 9fbd37c40d
commit 12baf3a68e
1 changed files with 5 additions and 7 deletions

View File

@ -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
</VirtualHost>
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