LNMP一键包部署从入门到精通之单机环境部署个人博客系统

LNMP单机环境部署个人博客系统

写在前边

在开始实践之前确保你的LNMP环境部署完成

如果还未部署 点击此处转到部署安装指南

开始部署

一、博客系统文件的选择下载与解压

1.博客系统版本选择
  • 我这里选择与部署安装指南中相同的wordpress6.4.2中文版 点击这里跳转
2.下载与解压文件
curl -o /home/wwwroot/default/wordpress.tar.gz  https://cn.wordpress.org/latest-zh_CN.tar.gz && cd /home/wwwroot/default && tar -zxvf wordpress.tar.gz && rm -rf wordpress.tar.gz &&nginx -s reload

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

3.检测网页状态
  • 浏览器输入x.x.x.x/wordpresss x.x.x.x 为自己虚拟机IP

二、数据库相关配置

1.创建存放个人博客系统的数据库
mysql -uroot -pAbc@1234 -e"create database wordpress default charset 'utf8';"
  • 使用此命令检查
mysql -uroot -pAbc@1234 -e"show  create database wordpress;"
mysql -uroot -pAbc@1234 -e"show  create database wordpress;"
+-----------+--------------------------------------------------------------------------------------------------+
| Database  | Create Database                                                                                  |
+-----------+--------------------------------------------------------------------------------------------------+
| wordpress | CREATE DATABASE `wordpress` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci */ |
+-----------+--------------------------------------------------------------------------------------------------+
2.授权数据库给密码用户
mysql -uroot -pAbc@1234 -e"grant all privileges on wordpress.* to 'wordpress'@'localhost' identified by 'Abc@1234';flush privileges;"
  • 使用此命令检测
mysql -uroot -pAbc@1234 -e"select user,host,password from mysql.user;"
+-------------+-----------+-------------------------------------------+
| User        | Host      | Password                                  |
+-------------+-----------+-------------------------------------------+
| mariadb.sys | localhost |                                           |
| root        | localhost | *3930876FA8B772FDE4FB8ED345D32585735D09F8 |
| mariadb     | localhost | invalid                                   |
| PUBLIC      |           |                                           |
| wordpress   | localhost | *3930876FA8B772FDE4FB8ED345D32585735D09F8 |
+-------------+-----------+-------------------------------------------+

三 、博客网页相关配置

1.再次进入wordpress网站
  • 浏览器输入x.x.x.x/wordpresss
2.注意细节信息

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

3.点击现在开始
  1. 数据库名 => 上边创建的数据库 => wordpress
  2. 用户名 => 授权数据库时的用户 => wordpress
  3. 密码 => 授权数据库时用户的密码 => Abc@1234
  4. 点击提交

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

  • 核对一下?

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

  • 解决无法写入wp-config.php的问题

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

  1. 更给权限
    • 权限涉及到安全问题不太建议
chmod 777 -R /home/wwwroot/default/wordpress && chown -R root:root /home/wwwroot/default/wordpress && nginx -s reload
  • 使用细节信息的提示与该页的提示完成
    • 创建并修改文件
vi /home/wwwroot/default/wordpress/wp-config.php
  • 这个信息默认进入这个页面就全选了只需要右击粘贴到文件里复制
<?php
/**
 * The base configuration for WordPress
 *
 * The wp-config.php creation script uses this file during the installation.
 * You don't have to use the web site, you can copy this file to "wp-config.php"
 * and fill in the values.
 *
 * This file contains the following configurations:
 *
 * * Database settings
 * * Secret keys
 * * Database table prefix
 * * ABSPATH
 *
 * @link https://wordpress.org/documentation/article/editing-wp-config-php/
 *
 * @package WordPress
 */

// ** 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', 'wordpress' );

/** Database password */
define( 'DB_PASSWORD', 'Abc@1234' );

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

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

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

/**#@+
 * Authentication unique keys and salts.
 *
 * Change these to different unique phrases! You can generate these using
 * the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}.
 *
 * 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.
 *
 * @since 2.6.0
 */
define( 'AUTH_KEY',         '[G+Nba[ASkojvYa+FZSlU%v;#dK./;%xvwA<g3DgYFSU*<y2=%jDn3FO;8J.7qCI' );
define( 'SECURE_AUTH_KEY',  'Npk^83upjep,5#Ib<?(u-W[v@6aUMS{eMiz;W8i/4XT@(Et)*K2x%lYha~_<,kls' );
define( 'LOGGED_IN_KEY',    '&?J6vmAZTOV43VOA^7:@IjA5 |pLJk*c0~`e&<3A,|c;5Gf:T>jG-bX(c0&ll={%' );
define( 'NONCE_KEY',        'gCzg]^58<$)<qkm,66zhD9&|?BNMFo6@h0U{1UG*/zf1P${?})&WgU>_qnw|f`?Z' );
define( 'AUTH_SALT',        '=Y<c=pJ;UqnQ:CLGB<6GA>]+THC: |jbiv.h0J}j|GZw2}b[/E8I[OCA;w_ @(-_' );
define( 'SECURE_AUTH_SALT', ')l::kj}<o_p`fUEiRTml0[W#p^jEriF)^d<t+Nv3ceQjBruO:W_HeQOK .oR/(.[' );
define( 'LOGGED_IN_SALT',   '>^^ u_j9SmmS yG#RuLOcvqInGLxx3|e?wGwYZ/O,BLLB3dFNWU57:CHKgn$pum?' );
define( 'NONCE_SALT',       'LR4]|$6wzZCBLiJB$83TAE>![ft0DM]ZI)Ygu%Fl-kvx>4`b^=D6iR5@3H!=B$Vs' );

/**#@-*/

/**
 * WordPress database table prefix.
 *
 * You can have multiple installations in one database if you give each
 * a unique prefix. Only numbers, letters, and underscores please!
 */
$table_prefix = 'wp_';

/**
 * For developers: WordPress debugging mode.
 *
 * Change this to true to enable the display of notices during development.
 * It is strongly recommended that plugin and theme developers use WP_DEBUG
 * in their development environments.
 *
 * For information on other constants that can be used for debugging,
 * visit the documentation.
 *
 * @link https://wordpress.org/documentation/article/debugging-in-wordpress/
 */
define( 'WP_DEBUG', false );

/* Add any custom values between this line and the "stop editing" line. */



/* That's all, stop editing! Happy publishing. */

/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
	define( 'ABSPATH', __DIR__ . '/' );
}

/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';

  • 什么你连按下i进入输入模式都忘记了?

  • 下一步重新加载nginx

nginx -s reload
4.点击运行安装
  1. 站点标题 => 开心-开心急了的小破站
  2. 用户名 => happy
  3. 密码 => happyagain
  4. 邮箱 => testqq.com

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

  • 对照一下?

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

  • 点击安装wordpress

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

5.登录wordpress写一篇博客
  1. 登录
image-20240119162921982

2.写一篇博客

image-20240119163139894
  • 跳过提示

粘贴下边文本


  • 5
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

开心-开心急了

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值