미니프로젝트 진행 및 README 작성
기본설정 사용
기본설정 사용
기본설정 사용
기본설정 사용
기본설정 사용
기본설정 사용
기본설정 사용
기본설정 사용
기본설정 사용
기본설정 사용
기본 설정 사용
기본 설정 사용
설저사항 검토
생성한 키가 있는 윈도우 폴더> ssh -i .\키 파일 ec2-user@bastion의 퍼블릭 IP
Last login: Fri Apr 8 10:28:19 2022 from *
__| __|_ )
_| ( / Amazon Linux 2 AMI
___|\___|___|
https://aws.amazon.com/amazon-linux-2/
14 package(s) needed for security, out of 17 available
Run "sudo yum update" to apply all updates.
기본 설정 사용
기본 설정 사용
설저사항 검토
생성한 키가 있는 윈도우 폴더> ssh -i .\키 파일 ec2-user@bastion의 퍼블릭 IP
Last login: Fri Apr 8 10:28:19 2022 from *
__| __|_ )
_| ( / Amazon Linux 2 AMI
___|\___|___|
https://aws.amazon.com/amazon-linux-2/
14 package(s) needed for security, out of 17 available
Run "sudo yum update" to apply all updates.
[ec2-user@bastion ~]$ vi .ssh/key
[ec2-user@bastion ~]$ chmod 400 .ssh/key
[ec2-user@bastion ~]$ ssh -i .ssh/key ec2-user@web server의 프라이빗 IP
Last login: Fri Apr 8 10:32:18 2022 from bastion
__| __|_ )
_| ( / Amazon Linux 2 AMI
___|\___|___|
https://aws.amazon.com/amazon-linux-2/
14 package(s) needed for security, out of 17 available
Run "sudo yum update" to apply all updates.
[ec2-user@webserver ~]$
[ec2-user@webserver ~]$ sudo yum -y install mariadb-server
[ec2-user@webserver ~]$ sudo yum -y install httpd
[ec2-user@webserver ~]$ sudo systemctl start httpd
[ec2-user@webserver ~]$ sudo systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[ec2-user@webserver ~]$ sudo amazon-linux-extras install -y lamp-mariadb10.2-php7.2 php7.2
[ec2-user@webserver ~]$ wget https://wordpress.org/latest.tar.gz
[ec2-user@webserver ~]$ tar -xzf latest.tar.gz
[ec2-user@webserver ~]$ ls wordpress/
index.php wp-includes
license.txt wp-links-opml.php
readme.html wp-load.php
wp-activate.php wp-login.php
wp-admin wp-mail.php
wp-blog-header.php wp-settings.php
wp-comments-post.php wp-signup.php
wp-config-sample.php wp-trackback.php
wp-content xmlrpc.php
wp-cron.php
[ec2-user@webserver ~]$ cp wordpress/wp-config-sample.php wordpress/wp-config.php
[ec2-user@webserver ~]$ vim wordpress/wp-config.php
...
// ** Database settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpress-db' );
/** Database username */
define( 'DB_USER', 'wordpress-user' );
/** Database password */
define( 'DB_PASSWORD', '데이터베이스 비밀번호' );
/** Database hostname */
define( 'DB_HOST', 'RDS의 엔드포인트' );
...
[ec2-user@webserver ~]$ sudo cp -r wordpress/* /var/www/html/
[ec2-user@webserver ~]$ sudo vim /etc/httpd/conf/httpd.conf
<Directory "/var/www/html">
...
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
...
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
DirectoryIndex index.php
</IfModule>
[ec2-user@webserver ~]$ sudo chown -R apache /var/www
[ec2-user@webserver ~]$ sudo chgrp -R apache /var/www
[ec2-user@webserver ~]$ sudo chmod 2775 /var/www
[ec2-user@webserver ~]$ find /var/www -type d -exec sudo chmod 2775 {} \;
[ec2-user@webserver ~]$ find /var/www -type f -exec sudo chmod 0664 {} \;
[ec2-user@webserver ~]$ sudo systemctl restart httpd
기본 설정 사용
[ec2-user@webserver ~]$ mysql -u admin -p -h RDS의 엔드포인트
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 18
Server version: 8.0.27 Source distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [(none)]>
MySQL [(none)]> CREATE USER 'wordpress-user'@'10.0.%' IDENTIFIED BY '비밀번호';
Query OK, 0 rows affected (0.00 sec)
MySQL [mysql]> select host,user from user;
+-----------+------------------+
| host | user |
+-----------+------------------+
| % | admin |
| 10.0.% | wordpress-user |
| localhost | mysql.infoschema |
| localhost | mysql.session |
| localhost | mysql.sys |
| localhost | rdsadmin |
+-----------+------------------+
7 rows in set (0.00 sec)
MySQL [(none)]> CREATE DATABASE `wordpress-db`;
Query OK, 1 row affected (0.01 sec)
MySQL [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| wordpress-db |
+--------------------+
5 rows in set (0.00 sec)
MySQL [(none)]> GRANT ALL PRIVILEGES ON `wordpress-db`.* TO "wordpress-user"@"10.0.%";
Query OK, 0 rows affected (0.01 sec)
MySQL [mysql]> SHOW GRANTS FOR 'wordpress-user'@'10.0.%';
+-----------------------------------------------------------------------+
| Grants for wordpress-user@10.0.%
|
+-----------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `wordpress-user`@`10.0.%`
|
| GRANT ALL PRIVILEGES ON `wordpress-db`.* TO `wordpress-user`@`10.0.%` |
+-----------------------------------------------------------------------+
2 rows in set (0.01 sec)
MySQL [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)