AWS 高可用AWS架构方案-Wordpress-3
1. VPC_SG_IAM_RDS_EFS(所有的资源应该使用CloudFormation去创建)
1.1 创建VPC网络
子网掩码划分,最小不能小于/28,aws自己要占5个IP地址(一个vpc路由器地址,一个做vpc dns服务器地址,一个预留,一个广播地址)
1.2 创建安全组
1.3 创建IAM角色
1.4 创建RDS实例
1.5 创建EFS文件系统
2. 安装Apache&PHP,配置wordpress
2.1 配置:
yum install httpd24 -y chkconfig httpd on yum -y install php55 php55-bcmath php55-devel php55-common php55-cli php55-pecl-apc php55-pdo php55-mysql php55-xml php55-gd php55-mbstring php-pear php55-mysqlnd php55-mcrypt sudo yum install -y amazon-efs-utils sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport fs-469e6527.efs.ap-northeast-2.amazonaws.com:/ /var/www/html/ cd /var/www/html/ wget https://wordpress.org/latest.zip unzip latest.zip mv wordpress/* /var/www/html/ rm -rf latest.zip wordpress/ chown -R apache:apache /var/www/html/* chmod -R 755 /var/www/html/*
2.2 配置wordpress
[root@ip-192-168-3-73 html]# vim wp-config.php
[root@ip-192-168-3-73 html]#
测试,所以不需要Google搜索
2.3 登陆方式:
http://13.209.82.198/wp-admin/
2.4测试:
写一个test page
2.5 Bootstrap脚本
#!/bin/bash sudo -s sudo yum update -y yum install httpd24 -y chkconfig httpd on yum -y install php55 php55-bcmath php55-devel php55-common php55-cli php55-pecl-apc php55-pdo php55-mysql php55-xml php55-gd php55-mbstring php-pear php55-mysqlnd php55-mcrypt sudo yum install -y amazon-efs-utils sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport fs-469e6527.efs.ap-northeast-2.amazonaws.com:/ /var/www/html sudo echo "fs-469e6527.efs.ap-northeast-2.amazonaws.com:/ /var/www/html nfs4 nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,_netdev,noresvport 0 0" >> /etc/fstab cd /var/www/html echo "<?php phpinfo(); ?>" > phpinfo.php service httpd start wget https://wordpress.org/latest.zip unzip latest.zip mv wordpress/* /var/www/html/ rm -rf wordpress/ latest.zip sudo chown -R apache:apache /var/www/html/* sudo chmod -R 775 /var/www/html