LAMP搭建wordpress并使用reids加速网页

news2024/9/29 7:22:10
L	linux
A	apache hhtpd
M	mysql/maridb
P	PHP

1、 安装php

rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
yum install -y --enablerepo=remi --enablerepo=remi-php72 php php-opcache php-devel php-mysqlnd php-gd php-redis

2、 安装mysql5.7

2.1、搭建mysql源
cd /etc/yum.repos.d

vim mysql.repo

[mysql]
name=mysql
baseurl=http://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-5.7-community-el7-x86_64/
enabled=1
gpgcheck=0
2.2、安装mysql
yum -y install mysql mysql-server
2.3、启动并自启mysql
systemctl enable mysqld --now
systemctl status mysqld
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2023-09-07 13:26:43 CST; 50s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 8682 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 8632 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 8686 (mysqld)
   CGroup: /system.slice/mysqld.service
           └─8686 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

Sep 07 13:26:37 ecs-1cee systemd[1]: Starting MySQL Server...
Sep 07 13:26:43 ecs-1cee systemd[1]: Started MySQL Server.
cat /var/log/mysqld.log | grep pass
2023-09-07T06:47:10.572362Z 1 [Note] A temporary password is generated for root@localhost: /#7BEsP?dh1P	# mysql启动日志里面会包含临时密码
mysql -uroot -p'/#7BEsP?dh1P'	
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.43

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'o*zu+1FzyG3';		#修改密码为o*zu+1FzyG3 
Query OK, 0 rows affected (0.00 sec)

[root@ecs-1cee yum.repos.d]# mysql -uroot -p'o*zu+1FzyG3'	#使用新密码登录
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.43 MySQL Community Server (GPL)

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database wordpress default character set utf8 collate utf8_general_ci		#创建wordpress数据库,字符集是utf8
    -> ;
Query OK, 1 row affected (0.00 sec)

3、 安装部署httpd服务

3.1、安装httpd服务
yum -y install httpd
3.2、启动并自启
systemctl enable httpd --now
systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2023-09-07 13:35:48 CST; 9s ago
     Docs: man:httpd(8)
           man:apachectl(8)
 Main PID: 8774 (httpd)
   Status: "Total requests: 0; Current requests/sec: 0; Current traffic:   0 B/sec"
   CGroup: /system.slice/httpd.service Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
           ├─8774 /usr/sbin/httpd -DFOREGROUND
           ├─8775 /usr/sbin/httpd -DFOREGROUND
           ├─8776 /usr/sbin/httpd -DFOREGROUND
           ├─8777 /usr/sbin/httpd -DFOREGROUND
           ├─8778 /usr/sbin/httpd -DFOREGROUND
           └─8779 /usr/sbin/httpd -DFOREGROUND

Sep 07 13:35:48 ecs-1cee systemd[1]: Starting The Apache HTTP Server...
Sep 07 13:35:48 ecs-1cee httpd[8774]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the...is message
Sep 07 13:35:48 ecs-1cee systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.

4、 部署WordPress

4.1、下载WordPress

官网下载地址:https://cn.wordpress.org/download/

cd /opt
wget https://cn.wordpress.org/latest-zh_CN.zip
4.2、部署WordPress
unzip latest-zh_CN.zip
cp -r wordpress/ /var/www/html/
cd 	/var/www/html/wordpress
cp wp-config-sample.php wp-config.php

vi wp-config.php

// ** Database settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpress' );

/** Database username */
define( 'DB_USER', 'root' );

/** Database password */
define( 'DB_PASSWORD', 'o*zu+1FzyG3' );

/** Database hostname */
define( 'DB_HOST', 'localhost' );

/** Database charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );

/** The database collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );
chmod -R 777 /var/www/html/
systemctl restart httpd
4.3、访问wordpress
114.115.151.96/wordpress		#根据实际的IP或者域名进行访问

在这里插入图片描述
以下内容均可自定义

站点: wordpress
用户名:admin
密码:admin
您的电子邮箱地址:111@qq.com
最后点击安装WordPress

在这里插入图片描述

4.2、查看网页加载时间
  • 浏览器页面按"F12"键,勾选"Disable cache"(停用缓存)选
    项,查看页面加载时间。刷新 WordPress 界面,待其完全加载完成,可以在页面下方看到加
    载时间为31.18秒
    在这里插入图片描述

5、部署redis

5.1、安装redis
yum -y install redis
5.2、启动自启
systemctl enable redis --now
systemctl status redis
● redis.service - Redis persistent key-value database
   Loaded: loaded (/usr/lib/systemd/system/redis.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/redis.service.d
           └─limit.conf
   Active: active (running) since Thu 2023-09-07 15:23:24 CST; 1min 59s ago
 Main PID: 22558 (redis-server)
   CGroup: /system.slice/redis.service
           └─22558 /usr/bin/redis-server 127.0.0.1:6379

Sep 07 15:23:24 ecs-6822 systemd[1]: Starting Redis persistent key-value database...
Sep 07 15:23:24 ecs-6822 systemd[1]: Started Redis persistent key-value database

5.3、redis配置密码

vim /etc/redis.conf
  requirepass 123456
  bind 0.0.0.0
systemctl restart redis
5.3、在 wp-config.php 配置中配置redis连接信息
cd /var/www/html/wordpress/

vi wp-config.php

// ** Database settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpress' );

/** Database username */
define( 'DB_USER', 'root' );

/** Database password */
define( 'DB_PASSWORD', 'o*zu+1FzyG3' );

/** Database hostname */
define( 'DB_HOST', 'localhost' );

/** Database charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );

/** The database collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );

/*redis config*/
define('WP_REDIS_HOST', '127.0.0.1');
define('WP_REDIS_PORT', '6379');
define('WP_REDIS_PASSWORD', '123456');

redis连接信息一定要放到数据库连接信息后面才能生效

6、在wordpress中启动redis

安装redis插件
在这里插入图片描述

由于点击安装需要填写网站的域名和ftp信息,所以我觉定从官网上下载redis插件上传到wordpress里面
插件下载地址:https://cn.wordpress.org/plugins/

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/984512.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

考完试家长怎么查看孩子成绩和等级?

考试结束了,孩子们的成绩和等级也出来了,对于家长来说,如何快速方便地查看孩子的成绩和等级呢?今天,我要向大家介绍一个非常实用的工具——易查分,让家长们便捷高效了解孩子的学习成果。 好消息&#xff01…

如何封装自动化测试框架?(超详细~)

封装自动化测试框架,测试人员不用关注框架的底层实现,根据指定的规则进行测试用例的创建、执行即可,这样就降低了自动化测试门槛,能解放出更多的人力去做更深入的测试工作。 本篇文章就来介绍下,如何封装自动化测试框…

【已解决】ognl.PropertyAccessor

在Spring boot2.x用TemplateEngine处理数据得时候&#xff0c;出现以下错误&#xff1a; 定位到代码行&#xff1a; 解决办法&#xff1a;修改thymeleaf的依赖&#xff1a; <!-- thymeleaf --><dependency><groupId>org.thymeleaf</groupId><…

低功耗窗帘电机解决方案成功应用并通过 Matter 1.1 认证

Nordic Semiconductor官方宣布与HooRii Tech&#xff08;和众科技&#xff09;携手合作&#xff0c;基于 Nordic nRF52840 芯片平台打造的 HRN71模组&#xff0c;成功赋能低功耗窗帘电机品牌发布Matter产品。低功耗窗帘电机获得 Matter 1.1 认证意味着它具有与其他 Matter 认证…

C. Ntarsis‘ Set

Problem - C - Codeforces 思路&#xff1a;这个题求一个满足条件的最小的&#xff0c;我们可以想到二分可以求满足条件的最小值&#xff0c;我们考虑二分答案&#xff0c;当当前的枚举的为mid时&#xff0c;我们考虑它会怎样变化&#xff0c;首先一开始mid的排名就是mid&#…

Python,Bytetrack 源码解读,参数,源码解释,逐句分析代码,目标追踪

文章目录 1、得到索引2、高得分框参与匹配&#xff0c;可能会留下有匹配不了的框3、低得分框参与匹配4、处理 unconfirmed 匹配5、创建新的【STrack对象】6、扔掉太久没匹配到框的【STrack对象】7、输出追踪框 1、得到索引 self.args.track_thresh是轨迹阈值。轨迹的得分是iou…

RabbitMQ: topic 结构

生产者 package com.qf.mq2302.topic;import com.qf.mq2302.utils.MQUtils; import com.rabbitmq.client.Channel; import com.rabbitmq.client.Connection;public class Pubisher {public static final String EXCHANGE_NAME"mypubilisher";public static void ma…

c++通过tensorRT调用模型进行推理

模型来源&#xff1a; 算法工程师训练得到的onnx模型 c对模型的转换&#xff1a; 拿到onnx模型后&#xff0c;通过tensorRT将onnx模型转换为对应的engine模型&#xff0c;注意&#xff1a;训练用的tensorRT版本和c调用的tensorRT版本必须一致。 如何转换&#xff1a; 算法工…

Json“牵手”亚马逊商品详情数据方法,亚马逊商品详情API接口,亚马逊API申请指南

亚马逊平台是美国最大的一家网络电子商务公司&#xff0c;亚马逊公司是1995年成立&#xff0c;刚开始只做网上书籍售卖业务&#xff0c;后来扩展到了其他产品。现在已经是全世界商品品种最多的网上零售商和第二互联网公司&#xff0c;亚马逊是北美洲、欧洲等地区的主流购物平台…

为什么5G 要分离 CU 和DU?(4G分离RRU 和BBU)

在 Blog 一文中&#xff0c;5G--BBU RRU 如何演化到 CU DU&#xff1f;_5g rru_qq_38480311的博客-CSDN博客 解释了4G的RRU BBU 以及 5G CU DU AAU&#xff0c;主要是讲了它们分别是什么。但是没有讲清楚 为什么&#xff0c;此篇主要回答why。 4G 为什么分离基站为 RRU 和 BBU…

什么是原生IP?原生IP与住宅IP有何区别?

相信许多做跨境的都会接触到IP代理&#xff0c;比如电商平台、社媒平台、收款平台等等&#xff0c;都会检测IP。那也会经常听到一些词汇&#xff1a;原生IP、住宅IP&#xff0c;这两者之间有什么区别呢&#xff1f;什么业务需要用到呢&#xff1f;接下来带大家具体了解一下。 什…

React Antd可编辑单元格,非官网写法,不使用可编辑行和form验证

antd3以上的写法乍一看还挺复杂&#xff0c;自己写了个精简版 没用EditableRowCell的结构&#xff0c;也不使用Context、高阶组件等&#xff0c;不使用form验证 最终效果&#xff1a; class EditableCell extends React.Component {state {editing: false};toggleEdit () &…

SFUD固件移植

SFUD作用 SFUD 是一款开源的串行 SPI Flash 通用驱动库。由于现有市面的串行 Flash 种类居多&#xff0c;各个 Flash 的规格及命令存在差异&#xff0c; SFUD 就是为了解决这些 Flash 的差异现状而设计&#xff0c;让我们的产品能够支持不同品牌及规格的 Flash&#xff0c;提高…

Android 修改代码后不生效问题的终极方案

前言&#xff1a; 最近遇到几个项目&#xff0c;都出现了代码修改后&#xff0c;直接点studio上的run&#xff0c;跑起来后代码没生效&#xff0c;如果重新clean rebuild可以生效&#xff0c;但是这太浪费时间了。网上找了各种方案&#xff0c;前面几个项目&#xff0c;有的是可…

手写Spring:第19章-JDBC功能整合

文章目录 一、目标&#xff1a;JDBC功能整合二、设计&#xff1a;JDBC功能整合三、实现&#xff1a;JDBC功能整合3.1 工程结构3.2 整合JDBC功能核心类图3.3 数据源操作3.3.1 数据源操作抽象类3.3.2 JDBC 工具类 3.4 数据库执行3.4.1 语句处理器接口3.4.2 结果处理器接口3.4.3 行…

嵌入式Linux驱动开发(LCD屏幕专题)(四)

单Buffer的缺点与改进方法 1. 单Buffer的缺点 如果APP速度很慢&#xff0c;可以看到它在LCD上缓慢绘制图案 即使APP速度很高&#xff0c;LCD控制器不断从Framebuffer中读取数据来显示&#xff0c;而APP不断把数据写入Framebuffer 假设APP想把LCD显示为整屏幕的蓝色、红色 很…

线程池的实现

目录 一、线程池的实现 1.什么是线程池 2.设计线程类 3.设计线程池类 4.运行 5.RAII加锁改造 二、利用单例模式改造线程池 1.复习 2.饿汉模式 3.懒汉模式 关于系统编程的知识我们已经学完了&#xff0c;最后我们需要利用之前写过的代码实现一个线程池&#xff0c;彻底…

如何理解张量、张量索引、切片、张量维度变换

Tensor 张量 Tensor&#xff0c;中文翻译“张量”&#xff0c;是一种特殊的数据结构&#xff0c;与数组和矩阵非常相似。在 PyTorch 中&#xff0c;使用张量对模型的输入和输出以及模型的参数进行编码。 Tensor 是一个 Python Class。PyTorch 官方文档中定义“Tensor&#xff0…

Datawhale × 和鲸科技丨《2023 中国人工智能人才学习白皮书》发布!

2023 是一个历史性的年份&#xff0c;它标志着人工智能技术的崛起与普及&#xff0c;这一年里&#xff0c;AI 不仅在科技、经济、社会、文化等各个领域取得突破性的进展&#xff0c;也在人类日常生活中扮演愈加重要的角色。随着人工智能时代的加速到来&#xff0c;我国 AI 人才…