6. 몇 가지 힌트
• LAMP 설치 과정에서 단계별로 점검해야 한다!
• 어디서 잘못되었는지 초기에 인지할 필요가 있음
• 접근 허가에 특히 주의! /var/www/html
• 참고: https://chmodcommand.com/chmod-2775/
• WP salt에 주의
• https://kinsta.com/knowledgebase/wordpress-salts/
• 로그인할 때 브라우저 쿠키에 안전하게 저장할 목적으로 사용하는 키
• 플러그인으로 처리할 수도 있지만… 정석이니까 wp-config.php에서 수작
업으로 편집
7. 스크립트(1)
$ sudo yum update -y
$ sudo amazon-linux-extras install -y lamp-mariadb10.2-php7.2 php7.2
$ sudo yum install -y httpd mariadb-server
$ sudo systemctl start httpd
$ sudo systemctl enable httpd
$ sudo systemctl is-enabled httpd
1단계_ LAMP 설치
$ curl localhost
$ sudo usermod –a –G apache ec2-user
$ exit # 다시 로그인 한다
$ groups
$ sudo chown –R ec2-user:apache /var/www
$ sudo chmod 2775 /var/www && find /var/www –type d –exec sudo chmod 2775 {} ;
$ find /var/www –type f –exec sudo chmod 0664 {} ;
$ cd /var/www
$ echo “<?php phpinfo(); ?>” > /var/www/html/phpinfo.php
$ curl localhost/phpinfo.php
$ rm /var/www/html/phpinfo.php
2단계_ 그룹 추가 후 아파치 디렉토리 접근 권한 변경
8. 스크립트(2)
$ sudo systemctl start mariadb
$ sudo mysql_secure_installation
$ sudo systemctl enable mariadb
$ sudo yum install php-mbstring -y
$ sudo systemctl restart httpd
$ sudo systemctl restart php-fpm
$ cd /var/www/html
$ wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz
$ mkdir phpMyAdmin && tar xvpfz phpMyAdmin-latest-all-languages.tar.gz -C phpMyAdmin --strip-components 1
$ rm phpMyAdmin-latest-all-languages.tar.gz
$ sudo systemctl start mariadb
$ curl localhost/phpMyAdmin
3단계_ MariaDB 설정, phpMyAdmin 설치
$ cd
$ mkdir src
$ cd src
$ wget https://wordpress.org/latest.tar.gz
$ tar xvpfz latest.tar.gz
$ mysql -u root -p
mysql> CREATE USER ‘wpuser'@'localhost' IDENTIFIED BY 'your_strong_password';
mysql> CREATE DATABASE `wpdb`;
mysql> GRANT ALL PRIVILEGES ON `wpdb`.* TO ‘wpuser’@’localhost’;
mysql> FLUSH PRIVILEGES;
mysql> exit
4단계_ WP 설치
9. 스크립트(3)
$ cd wordpress/
$ cp wp-config-sample.php wp-config.php
$ wget --output-document=salt.txt https://api.wordpress.org/secret-key/1.1/salt/
$ vi wp-config.php
define('DB_NAME’, wpdb'); --> 수정
define('DB_USER', ‘wpuser'); --> 수정
define('DB_PASSWORD', 'your_strong_password'); --> 수정
<<<<<<<<<<<<<<< 앞서 wget으로 얻은 salt.txt 내용으로 변경한다 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
define( 'AUTH_KEY', 'put your unique phrase here' );
define( 'SECURE_AUTH_KEY', 'put your unique phrase here' );
define( 'LOGGED_IN_KEY', 'put your unique phrase here' );
define( 'NONCE_KEY', 'put your unique phrase here' );
define( 'AUTH_SALT', 'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT', 'put your unique phrase here' );
define( 'NONCE_SALT', 'put your unique phrase here' );
5단계_ WP 설치
$ cd ..
$ cp -a wordpress/ /var/www/html/
$ sudo vi /etc/httpd/conf/httpd.conf
<Directory "/var/www/html"> 영역에서 다음을 수정
AllowOverride None → ALL
$ sudo systemctl restart httpd
6단계_ WP 설정