공부합시다!/AWS

userdata : wordpress + rds

간서치 2022. 6. 30. 17:50
728x90

#! /bin/bash
sudo su -
yum install -y httpd
amazon-linux-extras enable php7.2
amazon-linux-extras enable lamp-mariadb10.2-php7.2
yum install -y php php-cli php-pdo php-fpm php-json php-mysqlnd mariadb
wget https://ko.wordpress.org/latest-ko_KR.tar.gz
tar xvfz latest-ko_KR.tar.gz
cp -a wordpress/* /var/www/html/
chown apache.apache /var/www/html/*
cp /var/www/html/wp-config-sample.php /var/www/html/wp-config.php
sed -i 's/DirectoryIndex index.html/DirectoryIndex index.php/g' /etc/httpd/conf/httpd.conf
sed -i 's/database_name_here/wordpress/g' /var/www/html/wp-config.php
sed -i 's/username_here/root/g' /var/www/html/wp-config.php
sed -i 's/password_here/It12345!/g' /var/www/html/wp-config.php
sed -i 's/localhost/ENDPOING/g' /var/www/html/wp-config.php
cat > /var/www/html/index.html << EOF
<html><body><h1>AWS-WEBSERVER</h1></body></html>
EOF
systemctl enable httpd
systemctl start httpd

728x90