Add updated_install1.sh

This commit is contained in:
RomanNum3ral 2025-05-28 23:05:23 +00:00
parent 48430444de
commit 24675aab3e
1 changed files with 65 additions and 0 deletions

65
updated_install1.sh Normal file
View File

@ -0,0 +1,65 @@
#!/bin/bash
apt update
apt upgrade -y
apt install -y apache2 ghostscript libapache2-mod-php mysql-server php php-bcmath php-curl php-imagick php-intl php-json php-mbstring php-mysql php-xml php-zip
sudo mkdir -p /srv/www
chown www-data: /srv/www
curl https://wordpress.org/latest.tar.gz | -u www-data tar zx -C /srv/www
cat << EOF | sudo tee /etc/apache2/sites-available/wordpress.conf > /dev/null
<VirtualHost *:80>
DocumentRoot /srv/www/wordpress
<Directory /srv/www/wordpress>
Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
Require all granted
</Directory>
<Directory /srv/www/wordpress/wp-content>
Options FollowSymLinks
Require all granted
</Directory>
</VirtualHost>
EOF
a2ensite wordpress
a2enmod rewrite
a2dissite 000-default
cat << EOF | sudo tee /etc/apache2/sites-available/wordpress.conf > /dev/null
<VirtualHost *:80>
ServerName wordpress.local
DocumentRoot /srv/www/wordpress
<Directory /srv/www/wordpress>
Options FollowSymLinks
AllowOverride Limit Options FileInfo
DirectoryIndex index.php
Require all granted
</Directory>
<Directory /srv/www/wordpress/wp-content>
Options FollowSymLinks
Require all granted
</Directory>
</VirtualHost>
EOF
HOSTNAME="wordpress.local"
IP="127.0.0.1"
LINE="$IP $HOSTNAME"
# Check if the entry already exists
if grep -q "$HOSTNAME" /etc/hosts; then
echo "Entry for $HOSTNAME already exists in /etc/hosts."
else
echo "Adding $HOSTNAME to /etc/hosts..."
echo "$LINE" | sudo tee -a /etc/hosts > /dev/null
echo "Done."
fi
a2ensite wordpress.conf
systemctl reload apache2
a2dissite 000-default.conf
systemctl reload apache2