阿里云ECS搭建WordPress

阿里云ECS搭建WordPress

𝓓𝓸𝓷 Lv6
一、阿里ECS主机配置
1.更新YUM
1
[root@izj6cg1qu2sfuvkuo ~]# yum update
2.修改主机名
1
2
3
4
5
6
7
[root@izj6cg1qu2sfuvkuo ~]# hostname vip
[root@izj6cg1qu2sfuvkuo ~]# hostnamectl set-hostname vip
[root@izj6cg1qu2sfuvkuo6wctbz ~]# vim /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

47.91.241.57 www.zhangdong.xin vip
3.安装screen
1
[root@vip ~]# yum -y install screen 
4.安装lrzsz
1
[root@vip ~]# yum -y install lrzsz
5.开通80端口入口规则

mark

mark

mark

mark

mark

二、安装Lnmp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
参考官方安装教程:
https://lnmp.org/install.html


[root@vip ~]# screen -S lnmp
[root@vip ~]# cd /opt
[root@vip lnmp1.4]# wget -c http://soft.vpser.net/lnmp/lnmp1.4.tar.gz && tar zxf lnmp1.4.tar.gz && cd lnmp1.4 && ./install.sh lnmp
--2017-09-01 14:13:55-- http://soft.vpser.net/lnmp/lnmp1.4.tar.gz
Resolving soft.vpser.net (soft.vpser.net)... 50.116.14.213, 2604:a880:1:20::5f9:4001
Connecting to soft.vpser.net (soft.vpser.net)|50.116.14.213|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 136882 (134K) [application/octet-stream]
Saving to: ‘lnmp1.4.tar.gz’

100%[==========================================================================================>] 136,882 267KB/s in 0.5s

2017-09-01 14:13:56 (267 KB/s) - ‘lnmp1.4.tar.gz’ saved [136882/136882]
+------------------------------------------------------------------------+
| LNMP V1.4 for CentOS Linux Server, Written by Licess |
+------------------------------------------------------------------------+
| A tool to auto-compile & install LNMP/LNMPA/LAMP on Linux |
+------------------------------------------------------------------------+
| For more information please visit https://lnmp.org |
+------------------------------------------------------------------------+
You have 5 options for your DataBase install.
1: Install MySQL 5.1.73
2: Install MySQL 5.5.56 (Default)
3: Install MySQL 5.6.36
4: Install MySQL 5.7.18
5: Install MariaDB 5.5.56
6: Install MariaDB 10.0.30
7: Install MariaDB 10.1.23
0: DO NOT Install MySQL/MariaDB
Enter your choice (1, 2, 3, 4, 5, 6, 7 or 0): 2
You will install MySQL 5.5.56
===========================
Please setup root password of MySQL.(Default password: root)
Please enter: 123456
MySQL root password: 123456
===========================
Do you want to enable or disable the InnoDB Storage Engine?
Default enable,Enter your choice [Y/n]: y
You will enable the InnoDB Storage Engine
===========================
You have 6 options for your PHP install.
1: Install PHP 5.2.17
2: Install PHP 5.3.29
3: Install PHP 5.4.45
4: Install PHP 5.5.38 (Default)
5: Install PHP 5.6.31
6: Install PHP 7.0.21
7: Install PHP 7.1.7
Enter your choice (1, 2, 3, 4, 5, 6 or 7): 4
You will install PHP 5.5.38
===========================
You have 3 options for your Memory Allocator install.
1: Don't install Memory Allocator. (Default)
2: Install Jemalloc
3: Install TCMalloc
Enter your choice (1, 2 or 3): 1
You will install not install Memory Allocator.

Press any key to install...or Press Ctrl+c to cancel

......

============================== Check install ==============================
Checking ...
Nginx: OK
MySQL: OK
PHP: OK
PHP-FPM: OK
Clean src directory...
+------------------------------------------------------------------------+
| LNMP V1.4 for CentOS Linux Server, Written by Licess |
+------------------------------------------------------------------------+
| For more information please visit https://lnmp.org |
+------------------------------------------------------------------------+
| lnmp status manage: lnmp {start|stop|reload|restart|kill|status} |
+------------------------------------------------------------------------+
| phpMyAdmin: http://IP/phpmyadmin/ |
| phpinfo: http://IP/phpinfo.php |
| Prober: http://IP/p.php |
+------------------------------------------------------------------------+
| Add VirtualHost: lnmp vhost add |
+------------------------------------------------------------------------+
| Default directory: /home/wwwroot/default |
+------------------------------------------------------------------------+
| MySQL/MariaDB root password: 123456 |
+------------------------------------------------------------------------+
+-------------------------------------------+
| Manager for LNMP, Written by Licess |
+-------------------------------------------+
| https://lnmp.org |
+-------------------------------------------+
nginx (pid 28438 28436) is running...
php-fpm is runing!
SUCCESS! MySQL running (28979)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
Install lnmp takes 28 minutes.
Install lnmp V1.4 completed! enjoy it.

三、添加主机
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
[root@vip ~]# lnmp vhost add 
+-------------------------------------------+
| Manager for LNMP, Written by Licess |
+-------------------------------------------+
| https://lnmp.org |
+-------------------------------------------+
Please enter domain(example: www.lnmp.org): www.zhangdong.xin
Your domain: www.zhangdong.xin
Enter more domain name(example: lnmp.org *.lnmp.org): zhangdong.xin
domain list: zhangdong.xin
Please enter the directory for the domain: www.zhangdong.xin
Default directory: /home/wwwroot/www.zhangdong.xin: /opt/wordpress/www.zhangdong.xin
Virtual Host Directory: /opt/wordpress/www.zhangdong.xin
Allow Rewrite rule? (y/n) y
Please enter the rewrite of programme,
wordpress,discuz,typecho,sablog,typecho rewrite was exist.
(Default rewrite: other): wordpress
You choose rewrite: wordpress
Allow access log? (y/n) y
Enter access log filename(Default:www.zhangdong.xin.log):
You access log filename: www.zhangdong.xin.log
Create database and MySQL user with same name (y/n) n
Add SSL Certificate (y/n) y
1: Use your own SSL Certificate and Key
2: Use Let's Encrypt to create SSL Certificate and Key
Enter 1 or 2: 2
Please enter your email address: 681333@163.com
It will be processed automatically.

Press any key to start create virtul host...

......
Test Nginx configure file......
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
Reload Nginx......
================================================
Virtualhost infomation:
Your domain: www.zhangdong.xin
Home Directory: /opt/wordpress/www.zhangdong.xin
Rewrite: wordpress
Enable log: yes
Create database: no
Create ftp account: no
Enable SSL: yes
=>Let's Encrypt
================================================
四、开启Sandir函数
1
2
3
php.ini文件中删掉sandir值:
[root@vip ~]# vim +303 /usr/local/php/etc/php.ini
[root@vip ~]# /etc/init.d/php-fpm restart
五、配置数据库
  • 如果没有在添加主机时候没有创建数据库可以在添加完主机后通过phpmyadmin配置,或者在Mysql命令行配置,默认密码root
  • 也可以在命令行添加数据库lnmp database add

通过图形配置数据库:

mark

1. 创建数据库

mark

2. 创建用户

mark

mark

3. 分配权限

mark

通过lnmp命令配置数据库:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[root@vps opt]# lnmp database add
+-------------------------------------------+
| Manager for LNMP, Written by Licess |
+-------------------------------------------+
| https://lnmp.org |
+-------------------------------------------+
Enter current root password of Database (Password will not shown):
OK, MySQL root password correct.
Enter database name: wordpress
Your will create a database and MySQL user with same name: wordpress
Please enter password for mysql user wordpress: 123456
Your password: 123456
Add database Sucessfully.

修改排序规则:
六、安装WordPress
1. 安装

上传WordPress安装包至服务器并将WordPress安装包内容全部解压至/opt/wordpress/www.zhangdong.me/目录下

1
2
3
4
[root@vip www.zhangdong.xin]# tar xvf wordpress-4.8.1-zh_CN.tar.gz 
[root@vip www.zhangdong.xin]# mv wordpress/* .
[root@vip www.zhangdong.xin]# rm -rf wordpress
[root@vip www.zhangdong.xin]# rm -rf wordpress-4.8.1-zh_CN.tar.gz
2. 分配权限
1
2
3
4
[root@vip www.zhangdong.xin]# chown -R www.www ../www.zhangdong.xin
chown: changing ownership of ‘../www.zhangdong.xin/.user.ini’: Operation not permitted
[root@vip www.zhangdong.xin]# chmod -R 755 ../www.zhangdong.xin
chmod: changing permissions of ‘../www.zhangdong.xin/.user.ini’: Operation not permitted
3. 配置WordPress

IE地址栏输入www.abc.com进入阔别已久的WordPress界面

mark

mark

mark

mark

  • Title: 阿里云ECS搭建WordPress
  • Author: 𝓓𝓸𝓷
  • Created at : 2024-07-02 10:29:37
  • Updated at : 2024-07-20 05:15:41
  • Link: https://www.zhangdong.me/aliyun-wordpress.html
  • License: This work is licensed under CC BY-NC-SA 4.0.
评论