[点晴永久免费OA]一文理解并玩转阿里云云服务器ECS实例
当前位置:点晴教程→点晴OA办公管理信息系统
→『 经验分享&问题答疑 』
1.云服务器 ECS 介绍云服务器( 1.1 |
特点 | 云服务器ECS | 传统服务器 |
---|---|---|
稳定 | 实例可用性达99.95% ,云盘数据可靠性不低于9999999% 自动宕机迁移,自动快照备份(需手动配置快照策略),数据恢复更方便 | 传统服务器受限于硬件可靠性,易出问题需手工备份,人工数据恢复困难、耗时 |
弹性 | 自由配置CPU 内存、芾宽,可随时升级升级配置数据不丢失,业务暂停时间可控 | 固定配置,难以满足各类需求改配置需硬件升级,周期长,服务停止时间不可控 |
安全 | 免费提供DDoS 防护、木马查杀。防暴力破解等服务可轻松实现多用户对多服务器的访问控制 | 需颛外购买、部署各种安全措施基本上做不到多用户对多服务器访问控制 |
成本 | 高性价比,支持包年包月成按量计费,满足不同需求无需服务器网络和硬件等维护, 0 成本运维 | 租用费用高,只能包年包月购买大量人员负责机器运维,成本高 |
易用性 | 丰富的操作系统和应用软件,通过镜像可- -键简单部署同一镜像可在多台 ECS 中快速复制环境,轻松扩展 | 几乎不提供任何软件支持新增服务器需人工重复所有的部署操作 |
可拓展性 | ECS 可与阿里云各种丰富的云产晶无缝衔接可持续为业务发展提供完整的计算、存储、安全等解决方案 | 很难在同一服务商内找到完整的服务不能保证业务增长的可扩展性和持续性 |
一个云服务器ECS
实例等同于一台虚拟计算机,包含CPU、内存、操作系统、带宽、磁盘等最基础的计算组件。您可以方便的定制、更改实例的配置。您对该虚拟机拥有完全的控制权,和您本地服务器的区别在于,您只需要登录到阿里云,即可使用云服务器,进行独立的管理、配置等操作。
云服务器(Elastic Compute Service
,简称ECS
)是- -种简单高效、处理能力可弹性伸缩的计算服务,帮助您快速构建更稳定、安全的应用,提升运维效率,降低IT
成本,使您更专注于核心业务创新。
在控制面板中选择实例,进行实例的启动与停止操作。
云服务器配置变更温馨提示:
# 实例规格变更或经典网络类型实例的首次0Mbps
带宽升级:
支付完成后您需要通过ECS
控制台或ECS API
重启ECS
实例,配置变更才能生效;通过其他方式重启实例无效。
**# 带宽升级(除经典网络类型实例的首次0Mbps
带宽升级外) :**
无需重启您的ECS
实例,支付完成后立即生效。
什么情况下需要更换操作系统?
Windows Linux 系统内含正版激活 最流行的服务器端操作系统,强大的安全性和稳定性 适合于运行Windows下开发的程序 免费且开源,轻松建立和编译源代码如.net等 支持SQL Server等数据库(需自行安装)。 通过SSH方式远程访问您的ECS实例 可以使用远程桌面方式登录进行管理 一般用于高性能web等服务器应用,支持常见的 PHP/Python
等编程语言,支持MySQL
等数
磁盘种类 普通云盘 SSD云盘 高效云盘 单盘最大容量 2000GB
32768GB
32768GB
单盘最大 IOPS
数百 20000
3000
单盘最大吞吐量 30MBps
256MBps
80MBps
访问时延 5~10ms
0.5 ~ 2ms
1~3ms
数据可靠性 采用阿里云飞天分布式存储技术三份数据副本可提供 99.9999999%
的数据可靠性典型场景 数据不被经常访问或者低 I/0
负载的应用场景I/O
密集型应用中大型关系数据库NoSQL
数据库中小型数据库 大型开发测试服务器 log
快照作为一种便捷高效的数据保护服务手段,推荐应用于以下业务场景中:
以利用快照定期的对重要业务数据进行备份,来应对误操作、攻击、病毒等导致的数据丢失风险。
创建-份或多份数据快照,一旦升级、迁移过程中出现任何问题,可以通过数据快照及时恢复到正常的系统数据状态。
用户可以通过对生产数据创建快照,从而为数据挖掘、报表查询、开发测试等应用提供近实时的真实生产数据。
如图所示:
镜像是云服务器ECS
实例运行环境的模板, - -般包括操作系统和预装的软件。
可以使用镜像创建新的ECS
实例和更换ECS
实例的系统盘。
云服务器ECS提供了以下灵活多样的方式让您方便的获取镜像:
选择阿里云官方提供的公共镜像(支持Linux
和Windows
的多个发行版本)
去镜像市场选择第三E
方服务商(ISV
)提供的镜像
根据现有的云服务器ECS
实例创建自定义镜像
选择其他阿里云用户共享给您的镜像
可以把线下环境的镜像文件导入到ECS
的集群中生成一个自定义镜像
还可以把自定义镜像复制到其他地域,实现环境和应用的跨地域一致性部署。
复制、共享与导入镜像,使用云市场镜像。
安全组是一种虚拟防火墙,具备状态检测包过滤功能。安全组用于设置单台或多台云服务器的网络访问控制,它是重要的网络安全隔离手段用于在云端划分安全域。
安全组是一个逻辑上的分组,这个分组是由同一个地域内具有相同安全保护需求并相互信任的实例组成。每个实例至少属于一个安全组,在创建的时候就需要指定。
同一安全组内的实例之间网络互通,不同安全组的实例之间默认内网不通。
可以授权两个安全组之间互访。
优先级可选范围为1-100
,默认值为1
,即最高优先级。
ECS
搭建云上博客系统# 适合个人用户的配置
类型 配置 入门型 1vCPU1GB
内存1MB
宽带基础型 1vCPU2GB
内存1MB
宽带通用型 2vCPU4GB
内存1MB
宽带进阶型 4vCPU8GB
内存1MB
宽带
# 适用于企业用户的配置
类型 配置 内存型 1:8 (vCPU:内存)
分配,I/O
优化,适用 Cache/Redis
、搜索类、内存数据库等需使用大量内存的应用。计算型 最大规格为 40核vCPU
, 224 GB
内存,可以满足CPU
密集型超稳定计算需求。通用型 IntelXeonE5CPU
,DDR4
内存,最大256Mbps
吞吐量,最大20000IOPS
随机读写,已成为70%
企业用户的选择。安全型 购买 ECS
时直接绑定安全增强服务, DDoS
防护阈值10GB
起,支持手动解除黑洞,支持5* 8
小时安全事件响应。
对比项 包年包月 按量付费 付款方式 预付费。计费单位为元月。 后付费。计费单位为元小时。不足1小时,按1小时计 价格 平均每小时价格低。 平均每小时价格高。 带宽 支持固定带宽和按实际流量两种计费方式。 支持固定带宽和按实际流量两种计费方式。 实例规格升级 随时升级。-旦升级,将适用于整个购买周期。请参见升 不支持升级 芾宽规格升级 固定芾宽随时升级,至少升级1天。 不支持升级 使用场景 适用于固定的7x24服务,如Web服务。 适用于有爆发业务量,例如临时扩展、临时测试、科学计 能否释放 不能提前释放。 可随时释放。请参见释放实例。 域名备案 支持 不支持.
一般WEB环境包括:
LAMP、LNMP、JAVA、Window、Node.js Docker
,根据应用需要进行部署。
ECS
实例上部署WordPress
博客系统采用SSH
工具远程连接到ECS
云服务器:
Connecting to 101.132.181.141:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
WARNING! The remote SSH server rejected X11 forwarding request.
Last login: Sat Feb 3 07:23:31 2024 from 47.96.60.214
Welcome to Alibaba Cloud Elastic Compute Service !
Apache
是Web
服务器软件。本步骤将指导您如何在ECS
实例上安装并配置Apache
服务。
执行如下命令,安装Apache
服务及其扩展包。
[root@iZuf61nsf0io1gwcv90d1nZ ~]# yum -y install httpd mod_ssl mod_perl mod_auth_mysql
Loaded plugins: fastestmirror
Determining fastest mirrors
base | 3.6 kB 00:00:00
epel | 4.7 kB 00:00:00
extras | 2.9 kB ……
Dependency Updated:
glibc.x86_64 0:2.17-326.el7_9 glibc-common.x86_64 0:2.17-326.el7_9 nscd.x86_64 0:2.17-326.el7_9
Complete!
[root@iZuf61nsf0io1gwcv90d1nZ ~]#
# 查看Apache
是否安装成功:
[root@iZuf61nsf0io1gwcv90d1nZ ~]# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built: May 30 2023 14:01:11
[root@iZuf61nsf0io1gwcv90d1nZ ~]# systemctl start httpd.service
[root@iZuf61nsf0io1gwcv90d1nZ ~]#
由于使用WordPress
搭建云上博客,需要使用MySQL
数据库存储数据。本步骤将指导您如何在ECS
实例上安装MySQL
的开源替代品MariaDB
(MariaDB兼容MySQL
),并创建博客数据库。
# 安装MariaDB Server
[root@iZuf61nsf0io1gwcv90d1nZ ~]# yum install -y mariadb-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package mariadb-server.x86_64 1:5.5.68-1.el7 will be installed
--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.68-1.el7 for package: 1:mariadb-server-5.5.68-1.el7.x86_64
--> Processing Dependency: mariadb(x86-64) = 1:5.5.68-1.el7 for package: 1:mariadb-server-5.5.68-1.el7.x86_64
--> Processing Dependency: perl-DBI for package: 1:mariadb-server-5.5.68-1.el7.x86_64
--> Processing Dependency: perl-DBD-MySQL for package: 1:mariadb-server-5.5.68-1.el7.x86_64
--> Processing Dependency: perl(DBI) for package: 1:mariadb-server-5.5.68-1.el7.x86_64
--> Processing Dependency: libaio.so.1(LIBAIO_0.4)(64bit) for package: 1:mariadb-server-5.5.68-1.el7.x86_64
Dependencies Resolved
===================================================================================================================
Dependency Installed:
libaio.x86_64 0:0.3.109-13.el7 mariadb.x86_64 1:5.5.68-1.el7 perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7
perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7 perl-DBD-MySQL.x86_64 0:4.023-6.el7 perl-DBI.x86_64 0:1.627-4.el7
perl-IO-Compress.noarch 0:2.061-2.el7 perl-Net-Daemon.noarch 0:0.48-5.el7 perl-PlRPC.noarch 0:0.2020-14.el7
Dependency Updated:
mariadb-libs.x86_64 1:5.5.68-1.el7
Complete!
[root@iZuf61nsf0io1gwcv90d1nZ ~]#
# 启动MariaDB Server
[root@iZuf61nsf0io1gwcv90d1nZ ~]# systemctl start mariadb
[root@iZuf61nsf0io1gwcv90d1nZ ~]# systemctl status mariadb
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
Active: active (running) since Sat 2024-02-03 07:35:12 CST; 23s ago
Process: 1864 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS)
Process: 1781 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
Main PID: 1863 (mysqld_safe)
CGroup: /system.slice/mariadb.service
├─1863 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
└─2029 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error...
Feb 03 07:35:10 iZuf61nsf0io1gwcv90d1nZ mariadb-prepare-db-dir[1781]: MySQL manual for more instructions.
Feb 03 07:35:10 iZuf61nsf0io1gwcv90d1nZ mariadb-prepare-db-dir[1781]: Please report any problems at http://mariadb.org/jira
Feb 03 07:35:10 iZuf61nsf0io1gwcv90d1nZ mariadb-prepare-db-dir[1781]: The latest information about MariaDB is available at ...g/.
Feb 03 07:35:10 iZuf61nsf0io1gwcv90d1nZ mariadb-prepare-db-dir[1781]: You can find additional information about the MySQL p...at:
Feb 03 07:35:10 iZuf61nsf0io1gwcv90d1nZ mariadb-prepare-db-dir[1781]: http://dev.mysql.com
Feb 03 07:35:10 iZuf61nsf0io1gwcv90d1nZ mariadb-prepare-db-dir[1781]: Consider joining MariaDB's strong and vibrant community:
Feb 03 07:35:10 iZuf61nsf0io1gwcv90d1nZ mariadb-prepare-db-dir[1781]: https://mariadb.org/get-involved/
Feb 03 07:35:11 iZuf61nsf0io1gwcv90d1nZ mysqld_safe[1863]: 240203 07:35:11 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Feb 03 07:35:11 iZuf61nsf0io1gwcv90d1nZ mysqld_safe[1863]: 240203 07:35:11 mysqld_safe Starting mysqld daemon with databas...ysql
Feb 03 07:35:12 iZuf61nsf0io1gwcv90d1nZ systemd[1]: Started MariaDB database server.
Hint: Some lines were ellipsized, use -l to show in full.
[root@iZuf61nsf0io1gwcv90d1nZ ~]#
# 设置数据库root用户的初始密码
[root@iZuf61nsf0io1gwcv90d1nZ ~]# mysqladmin -u root -p password
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'
# 解决办法:
[root@iZuf61nsf0io1gwcv90d1nZ ~]# systemctl stop mariadb
[root@iZuf61nsf0io1gwcv90d1nZ ~]#
[root@iZuf61nsf0io1gwcv90d1nZ /]# mysqld_safe --skip-grant-tables & mysql -uroot -p
[2] 2859
Enter password: 240203 08:16:55 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
240203 08:16:55 mysqld_safe A mysqld process already exists
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 1
Server version: 5.5.68-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [mysql]> update user set password=PASSWORD("SUccess202402") where user="root";
Query OK, 4 rows affected (0.00 sec)
Rows matched: 4 Changed: 4 Warnings: 0
MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [mysql]> quit
Bye
[2]+ Exit 1 mysqld_safe --skip-grant-tables
[root@iZuf61nsf0io1gwcv90d1nZ /]#
# 然后再更换密码:
[root@iZuf61nsf0io1gwcv90d1nZ mysql]# mysqladmin -u root -p password
Enter password:
New password:
Confirm new password:
[root@iZuf61nsf0io1gwcv90d1nZ mysql]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.68-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database wordpress;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]>
# 查看数据库:
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
| wordpress |
+--------------------+
5 rows in set (0.00 sec)
MariaDB [(none)]>
PHP
是一种广泛使用的通用开源脚本语言,适合于Web网站开发,它可以嵌入HTML
中。本步骤将指导您如何在ECS
实例上安装并配置PHP
服务。
[root@iZuf61nsf0io1gwcv90d1nZ /]# yum -y install php php-mysql gd php-gd gd-devel php-xml php-common php-mbstring php-ldap php-pear php-xmlrpc php-imap
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package gd.x86_64 0:2.0.35-27.el7_9 will be installed
--> Processing Dependency: libjpeg.so.62(LIBJPEG_6.2)(64bit) for package: gd-2.0.35-27.el7_9.x86_64
--> Processing Dependency: libjpeg.so.62()(64bit) for package: gd-2.0.35-27.el7_9.x86_64
--> Processing Dependency: libfontconfig.so.1()(64bit) for package: gd-2.0.35-27.el7_9.x86_64
--> Processing Dependency: libXpm.so.4()(64bit) for package: gd-2.0.35-27.el7_9.x86_64
--> Processing Dependency: libX11.so.6()(64bit) for package: gd-2.0.35-27.el7_9.x86_64
Dependencies Resolved
Installed:
gd.x86_64 0:2.0.35-27.el7_9 gd-devel.x86_64 0:2.0.35-27.el7_9 php.x86_64 0:5.4.16-48.el7
php-common.x86_64 0:5.4.16-48.el7 php-gd.x86_64 0:5.4.16-48.el7 php-imap.x86_64 0:5.4.16-9.el7
php-ldap.x86_64 0:5.4.16-48.el7 php-mbstring.x86_64 0:5.4.16-48.el7 php-mysql.x86_64 0:5.4.16-48.el7
php-pear.noarch 1:1.9.4-23.el7_9 php-xml.x86_64 0:5.4.16-48.el7 php-xmlrpc.x86_64 0:5.4.16-48.el7
Dependency Installed:
dejavu-fonts-common.noarch 0:2.33-6.el7 dejavu-sans-fonts.noarch 0:2.33-6.el7
expat-devel.x86_64 0:2.1.0-15.el7_9 fontconfig.x86_64 0:2.13.0-4.3.el7
fontconfig-devel.x86_64 0:2.13.0-4.3.el7 fontpackages-filesystem.noarch 0:1.44-8.el7
freetype-devel.x86_64 0:2.8-14.el7_9.1 libICE.x86_64 0:1.0.9-9.el7
libSM.x86_64 0:1.2.2-2.el7 libX11.x86_64 0:1.6.7-4.el7_9
libX11-common.noarch 0:1.6.7-4.el7_9 libX11-devel.x86_64 0:1.6.7-4.el7_9
libXau.x86_64 0:1.0.8-2.1.el7 libXau-devel.x86_64 0:1.0.8-2.1.el7
libXext.x86_64 0:1.3.3-3.el7 libXpm.x86_64 0:3.5.12-2.el7_9
libXpm-devel.x86_64 0:3.5.12-2.el7_9 libXt.x86_64 0:1.1.5-3.el7
libc-client.x86_64 0:2007f-16.el7 libjpeg-turbo.x86_64 0:1.2.90-8.el7
libjpeg-turbo-devel.x86_64 0:1.2.90-8.el7 libpng-devel.x86_64 2:1.5.13-8.el7
libuuid-devel.x86_64 0:2.23.2-65.el7_9.1 libxcb.x86_64 0:1.13-1.el7
libxcb-devel.x86_64 0:1.13-1.el7 libxslt.x86_64 0:1.1.28-6.el7
libzip.x86_64 0:0.10.1-8.el7 php-cli.x86_64 0:5.4.16-48.el7
php-pdo.x86_64 0:5.4.16-48.el7 php-process.x86_64 0:5.4.16-48.el7
t1lib.x86_64 0:5.1.2-14.el7 xorg-x11-proto-devel.noarch 0:2018.4-1.el7
zlib-devel.x86_64 0:1.2.7-21.el7_9
Dependency Updated:
expat.x86_64 0:2.1.0-15.el7_9 freetype.x86_64 0:2.8-14.el7_9.1 libblkid.x86_64 0:2.23.2-65.el7_9.1
libmount.x86_64 0:2.23.2-65.el7_9.1 libpng.x86_64 2:1.5.13-8.el7 libsmartcols.x86_64 0:2.23.2-65.el7_9.1
libuuid.x86_64 0:2.23.2-65.el7_9.1 util-linux.x86_64 0:2.23.2-65.el7_9.1 zlib.x86_64 0:1.2.7-21.el7_9
Complete!
[root@iZuf61nsf0io1gwcv90d1nZ /]#
# 创建测试页面
[root@iZuf61nsf0io1gwcv90d1nZ /]# echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php
[root@iZuf61nsf0io1gwcv90d1nZ /]#
# 重启Apache服务
[root@iZuf61nsf0io1gwcv90d1nZ /]# systemctl restart httpd
[root@iZuf61nsf0io1gwcv90d1nZ /]#
# 测试PHP信息
http://101.132.181.141/phpinfo.php
[root@iZuf61nsf0io1gwcv90d1nZ /]# yum -y install wordpress
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package wordpress.noarch 0:5.1.17-1.el7 will be installed
--> Processing Dependency: php-simplepie >= 1.3.1 for package: wordpress-5.1.17-1.el7.noarch
--> Processing Dependency: php-PHPMailer for package: wordpress-5.1.17-1.el7.noarch
--> Processing Dependency: php-getid3 for package: wordpress-5.1.17-1.el7.noarch
--> Processing Dependency: php-intl for package: wordpress-5.1.17-1.el7.noarch
--> Running transaction check
---> Package php-PHPMailer.noarch 0:5.2.27-1.el7 will be installed
---> Package php-getid3.noarch 1:1.9.22-1.el7 will be installed
--> Processing Dependency: php-composer(fedora/autoloader) for package: 1:php-getid3-1.9.22-1.el7.noarch
---> Package php-intl.x86_64 0:5.4.16-48.el7 will be installed
--> Processing Dependency: libicuuc.so.50()(64bit) for package: php-intl-5.4.16-48.el7.x86_64
--> Processing Dependency: libicuio.so.50()(64bit) for package: php-intl-5.4.16-48.el7.x86_64
--> Processing Dependency: libicui18n.so.50()(64bit) for package: php-intl-5.4.16-48.el7.x86_64
--> Processing Dependency: libicudata.so.50()(64bit) for package: php-intl-5.4.16-48.el7.x86_64
---> Package php-simplepie.noarch 0:1.3.1-4.el7 will be installed
--> Processing Dependency: php-IDNA_Convert for package: php-simplepie-1.3.1-4.el7.noarch
--> Running transaction check
---> Package libicu.x86_64 0:50.2-4.el7_7 will be installed
---> Package php-IDNA_Convert.noarch 0:0.8.0-2.el7 will be installed
---> Package php-fedora-autoloader.noarch 0:1.0.1-2.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
……
Dependency Installed:
libicu.x86_64 0:50.2-4.el7_7 php-IDNA_Convert.noarch 0:0.8.0-2.el7 php-PHPMailer.noarch 0:5.2.27-1.el7
php-fedora-autoloader.noarch 0:1.0.1-2.el7 php-getid3.noarch 1:1.9.22-1.el7 php-intl.x86_64 0:5.4.16-48.el7
php-simplepie.noarch 0:1.3.1-4.el7
Complete!
[root@iZuf61nsf0io1gwcv90d1nZ /]#
# 修改配置文件
[root@iZuf61nsf0io1gwcv90d1nZ /]# cd /usr/share/wordpress
[root@iZuf61nsf0io1gwcv90d1nZ wordpress]# ln -snf /etc/wordpress/wp-config.php wp-config.php
[root@iZuf61nsf0io1gwcv90d1nZ wordpress]# ll
total 172
-rw-r--r-- 1 root root 420 Dec 1 2017 index.php
-rw-r--r-- 1 root root 6919 Jan 12 2019 wp-activate.php
drwxr-xr-x 9 root root 4096 Feb 3 08:57 wp-admin
-rw-r--r-- 1 root root 369 Dec 1 2017 wp-blog-header.php
-rw-r--r-- 1 root root 2340 Jun 6 2020 wp-comments-post.php
lrwxrwxrwx 1 root root 28 Feb 3 08:59 wp-config.php -> /etc/wordpress/wp-config.php
-rw-r--r-- 1 root root 2898 Jan 8 2019 wp-config-sample.php
drwxr-xr-x 6 root root 4096 Feb 3 08:57 wp-content
-rw-r--r-- 1 root root 3847 Jan 9 2019 wp-cron.php
drwxr-xr-x 17 root root 12288 Feb 3 08:57 wp-includes
-rw-r--r-- 1 root root 2502 Jan 16 2019 wp-links-opml.php
-rw-r--r-- 1 root root 3306 Dec 1 2017 wp-load.php
-rw-r--r-- 1 root root 38883 Jan 12 2019 wp-login.php
-rw-r--r-- 1 root root 8353 Oct 18 2022 wp-mail.php
-rw-r--r-- 1 root root 17947 Jan 30 2019 wp-settings.php
-rw-r--r-- 1 root root 31085 Jan 17 2019 wp-signup.php
-rw-r--r-- 1 root root 4833 Oct 18 2022 wp-trackback.php
-rw-r--r-- 1 root root 3068 Aug 17 2018 xmlrpc.php
[root@iZuf61nsf0io1gwcv90d1nZ wordpress]#
# 移动wordpress
文件到Apache
根目录:
root@iZuf61nsf0io1gwcv90d1nZ wordpress]# mkdir /var/www/html/wp-blog
[root@iZuf61nsf0io1gwcv90d1nZ wordpress]# mv * /var/www/html/wp-blog/
[root@iZuf61nsf0io1gwcv90d1nZ wordpress]#
# 修改wp-config.php
配置文件:
[root@iZuf61nsf0io1gwcv90d1nZ wordpress]# sed -i 's/database_name_here/wordpress/' /var/www/html/wp-blog/wp-config.php
[root@iZuf61nsf0io1gwcv90d1nZ wordpress]# sed -i 's/username_here/root/' /var/www/html/wp-blog/wp-config.php
[root@iZuf61nsf0io1gwcv90d1nZ wordpress]# sed -i 's/password_here/SUccess202402/' /var/www/html/wp-blog/wp-config.php
[root@iZuf61nsf0io1gwcv90d1nZ wordpress]#
# 查看配置文件信息是否修改成功:
[root@iZuf61nsf0io1gwcv90d1nZ wordpress]# cat -n /var/www/html/wp-blog/wp-config.php
1 <?php
2 /**
3 * The base configuration for WordPress
4 *
5 * The wp-config.php creation script uses this file during the
6 * installation. You don't have to use the web site, you can
7 * copy this file to "wp-config.php" and fill in the values.
8 *
9 * This file contains the following configurations:
10 *
11 * * MySQL settings
12 * * Secret keys
13 * * Database table prefix
14 * * ABSPATH
15 *
16 * @link https://codex.wordpress.org/Editing_wp-config.php
17 *
18 * @package WordPress
19 */
20
21 // ** MySQL settings - You can get this info from your web host ** //
22 /** The name of the database for WordPress */
23 define( 'DB_NAME', 'wordpress' );
24
25 /** MySQL database username */
26 define( 'DB_USER', 'root' );
27
28 /** MySQL database password */
29 define( 'DB_PASSWORD', 'SUccess202402' );
30
31 /** MySQL hostname */
32 define( 'DB_HOST', 'localhost' );
33
34 /** Database Charset to use in creating database tables. */
35 define( 'DB_CHARSET', 'utf8' );
36
37 /** The Database Collate type. Don't change this if in doubt. */
38 define( 'DB_COLLATE', '' );
39
40 /**#@+
41 * Authentication Unique Keys and Salts.
42 *
43 * Change these to different unique phrases!
44 * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
45 * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
46 *
47 * @since 2.6.0
48 */
49 define( 'AUTH_KEY', 'put your unique phrase here' );
50 define( 'SECURE_AUTH_KEY', 'put your unique phrase here' );
51 define( 'LOGGED_IN_KEY', 'put your unique phrase here' );
52 define( 'NONCE_KEY', 'put your unique phrase here' );
53 define( 'AUTH_SALT', 'put your unique phrase here' );
54 define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
55 define( 'LOGGED_IN_SALT', 'put your unique phrase here' );
56 define( 'NONCE_SALT', 'put your unique phrase here' );
57
58 /**#@-*/
59
60 /**
61 * WordPress Database Table prefix.
62 *
63 * You can have multiple installations in one database if you give each
64 * a unique prefix. Only numbers, letters, and underscores please!
65 */
66 $table_prefix = 'wp_';
67
68 /**
69 * See http://make.wordpress.org/core/2013/10/25/the-definitive-guide-to-disabling-auto-updates-in-wordpress-3-7
70 */
71
72 /* Disable all file change, as RPM base installation are read-only */
73 define('DISALLOW_FILE_MODS', true);
74
75 /* Disable automatic updater, in case you want to allow
76 above FILE_MODS for plugins, themes, ... */
77 define('AUTOMATIC_UPDATER_DISABLED', true);
78
79 /* Core update is always disabled, WP_AUTO_UPDATE_CORE value is ignore */
80
81 /**
82 * For developers: WordPress debugging mode.
83 *
84 * Change this to true to enable the display of notices during development.
85 * It is strongly recommended that plugin and theme developers use WP_DEBUG
86 * in their development environments.
87 *
88 * For information on other constants that can be used for debugging,
89 * visit the Codex.
90 *
91 * @link https://codex.wordpress.org/Debugging_in_WordPress
92 */
93 define( 'WP_DEBUG', false );
94
95 /* That's all, stop editing! Happy publishing. */
96
97 /** Absolute path to the WordPress directory. */
98 if ( ! defined( 'ABSPATH' ) ) {
99 define('ABSPATH', '/usr/share/wordpress');
100 }
101
102 /** Sets up WordPress vars and included files. */
103 require_once( ABSPATH . 'wp-settings.php' );
[root@iZuf61nsf0io1gwcv90d1nZ wordpress]#
# 重启Apache服务
root@iZuf61nsf0io1gwcv90d1nZ wordpress]# systemctl restart httpd
[root@iZuf61nsf0io1gwcv90d1nZ wordpress]#
最后测试WordPress
页面,过程略。