aliyun搭博客从零到一

一、基础环境

lnmp      1台负载均衡SLB     2台ECS    1台 RDS

 二、lnmp搭建

1、#配置nginx的yum仓库

2、#yum install  -y  nginx

3、#yum -y install   php   php-mysql   gd  php-gd

4、[root@zjz1 ~]# vim   /etc/nginx/conf.d/default.conf  (  修改nginx配置文件来连接php)

 5、[root@apache ~]# rm -rf /usr/share/html/*
     [root@apache ~]# vim /usr/share/html/index.php  (测试连接)
<?php
$link=mysql_connect('数据库内网地址','登录名','密码');
if ($link)
echo "Successfuly";
else
echo "Faile";
mysql_close();
?>

6、[root@zjz1 ~]# systemctl restart nginx

7、访问测试

 

三、slb和rds

1、SLB负载均衡绑定两个ECS

2、数据库授权登录和账户白名单

 

3、登录mysql数据库创一个wordpress库

 四、上线博客代码

1、/usr/share/nginx/html/

 [root@zjz1 html]# unzip wordpress-5.0.4.zip  (上传博客代码压缩包并解压到nginx网页文件夹)

 

[root@zjz1 ~]# chmod 755 -R  /usr/share/nginx/html/*
[root@zjz1 ~]# cd /usr/share/nginx/html/

[root@zjz1 html]# vim wp-config.php

..........复制上图中的代码


2、 远程登录rds查看,查看数据是否写入。

[root@zjz1 html]# mysql -h rm-j6cxjn3uog9w77d23.mysql.rds.aliyuncs.com -uroot -pJsc151404
Welcome to the MariaDB monitor.  Commands end with ; or g.
Your MySQL connection id is 3574
Server version: 5.7.25-log 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)]> create database wordpress;
Query OK, 1 row affected (0.01 sec)

图形方式

原文地址:https://www.cnblogs.com/zjz20/p/11723406.html