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.点击现在开始
- 数据库名 => 上边创建的数据库 => wordpress
- 用户名 => 授权数据库时的用户 => wordpress
- 密码 => 授权数据库时用户的密码 => Abc@1234
- 点击提交
- 核对一下?
- 解决无法写入
wp-config.php
的问题
- 更给权限
- 权限涉及到安全问题不太建议
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.点击运行安装
- 站点标题 => 开心-开心急了的小破站
- 用户名 => happy
- 密码 => happyagain
- 邮箱 => testqq.com
- 对照一下?
- 点击安装wordpress
5.登录wordpress写一篇博客
- 登录
2.写一篇博客
- 跳过提示
粘贴下边文本