1. 准备LNMP环境

LNMP 是 Linux、Nginx、MySQL 和 PHP 的缩写,是 WordPress 博客系统依赖的基础运行环境。我们先来准备 LNMP 环境
  • 安装Nginx

使用 yum 安装Nginx:

yum install nginx -y

修改 /etc/nginx/conf.d/default.conf,去除对 IPv6 地址的监听:

server {
listen 80 default_server;
# listen [::]:80 default_server;
server_name _;
root /usr/share/nginx/html; # Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf; location / {
} error_page 404 /404.html;
location = /40x.html {
} error_page 500 502 503 504 /50x.html;
location = /50x.html {
} }

修改完成后,启动Nginx:

nginx

此时,可访问实验机器外网HTTP服务来确认是否已经安装成功。

将Nginx设置为开机自动启动:

chkconfig nginx on
  • 安装MyAQL

使用 yum 安装MySQL:

yum install mysql-server -y

安装完成后,启动MySQL服务:

service mysqld restart

设置MySQL账户root密码:

/usr/bin/mysqladmin -u root password '此处填密码'

将MySQL设置为开机自动启动:

chkconfig musqld on
  • 安装PHP

使用 yum 安装PHP:

yum install php-fpm php-mysql -y

安装之后,启动PHP-FPM进程:

service php-fpm start

启动之后,可以使用下面的命令查看PHP-FPM进程监听哪个端口:

netstat -nlpt | grep php-fpm

把PHP-FPM也设置成开机自动启动:

chkconfig php-fpm on

2. 安装并配置WordPress

  • 安装WordPress

配置好LNMP环境后,继续使用yum来安装WordPress

yum install wordpress -y

安装成功后,可以在/usr/share/wordpress看到wordpress的原代码了。

  • 配置数据库

进入MySQL:

mysql -uroot --password=’你的密码’

为WordPress创建一个数据库:

CREAT DATABASE wordpress;

MySQL部分设置完了,退出MySQL环境:

exit

把上述DB配置同步到word press的配置文件中,可以参考下面的配置:

<?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:
*
* * MySQL settings
* * Secret keys
* * Database table prefix
* * ABSPATH
*
* @link https://codex.wordpress.org/Editing_wp-config.php
*
* @package WordPress
*/ // ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'wordpress'); /** MySQL database username */
define('DB_USER', 'root'); /** MySQL database password */
define('DB_PASSWORD', 'MyPas$word4Word_Press'); /** MySQL 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', ''); /**#@+
* 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', 'put your unique phrase here');
define('SECURE_AUTH_KEY', 'put your unique phrase here');
define('LOGGED_IN_KEY', 'put your unique phrase here');
define('NONCE_KEY', 'put your unique phrase here');
define('AUTH_SALT', 'put your unique phrase here');
define('SECURE_AUTH_SALT', 'put your unique phrase here');
define('LOGGED_IN_SALT', 'put your unique phrase here');
define('NONCE_SALT', 'put your unique phrase here'); /**#@-*/ /**
* 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_'; /**
* See http://make.wordpress.org/core/2013/10/25/the-definitive-guide-to-disabling-auto-updates-in-wordpress-3-7
*/ /* Disable all file change, as RPM base installation are read-only */
define('DISALLOW_FILE_MODS', true); /* Disable automatic updater, in case you want to allow
above FILE_MODS for plugins, themes, ... */
define('AUTOMATIC_UPDATER_DISABLED', true); /* Core update is always disabled, WP_AUTO_UPDATE_CORE value is ignore */ /**
* 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 Codex.
*
* @link https://codex.wordpress.org/Debugging_in_WordPress
*/
define('WP_DEBUG', false); /* That's all, stop editing! Happy blogging. */ /** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', '/usr/share/wordpress'); /** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');
  • 配置Nginx

WordPress已经安装完毕,我们配置Nginx把请求转发给PHP-FPM来处理

首先,重命名默认的配置文件:

cd /etc/nginx/conf.d/
mv default.conf defaut.conf.bak

/etc/nginx/conf.d 创建 wordpress.conf 配置,参考下面的内容:

server {
listen 80;
root /usr/share/wordpress;
location / {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php index.php;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

配置后,通知Nginx进程重新加载:

nginx -s reload

3. 准备域名和解析

  • 注册、购买域名
  • 域名解析

ping域名通过后表示可以访问。

搭建WordPress个人博客的更多相关文章

  1. WordPress 建站教程:新手搭建 WordPress个人博客图文教程(完全版)

    前言 WordPress 作为动态博客的代表,至今已经有十几年历史,而且一直在更新发展中,功能强大,插件和主题丰富,WordPress搭建使用也很方便.作为个人站长和博主,很多都是从 WordPres ...

  2. 腾讯云-搭建 WordPress 个人博客

    搭建 WordPress 个人博客 准备 LNMP 环境 任务时间:30min ~ 60min LNMP 是 Linux.Nginx.MySQL 和 PHP 的缩写,是 WordPress 博客系统依 ...

  3. 基于 CentOS 搭建 WordPress 个人博客

    欢迎大家前往腾讯云+社区,获取更多腾讯海量技术实践干货哦~ 腾讯云提供了开发者实验室帮助用户搭建 WordPress 个人博客,教程内容如下,用户可以点击开发者实验室快速上机完成实验. 准备 LNMP ...

  4. 基于Ubuntu 搭建 WordPress 个人博客 - 开发者实验室 - 腾讯云

    1.准备 LAMP 环境 安装 Apache2 在终端输入该命令 ,使用 apt-get 安装 Apache2: sudo apt-get install apache2 -y 安装好后,您可以通过访 ...

  5. Debian 8.9 搭建wordpress个人博客

    想自己搭个博客玩玩,就搭建了此博客,过程可谓艰辛啊! 先在阿里云买了个  轻量应用服务器 1个月10块钱,好贵.... 用 windows sever 下载不了phpstudy,也不知道怎么回事... ...

  6. 5分钟搭建wordpress个人博客网站——宝塔傻瓜式部署,无坑系列,附赠主题和md插件[2021-12-31]

    一.前言 自从买了服务器,小编已经马不停蹄的学了两天服务搭建的知识,问了很多大佬,快速搭建自己的博客网站.有四种方式,我在这里全部分享给大家.自己已经搭建好,欢迎大家过来看一下,给你提供个思路哈! 小 ...

  7. 在服务器上搭建wordpress个人博客 php7.2+nginx+mysql+wordperss

    买了台VPS,准备搭建一个博客.用过几个博客框架还是觉得Wordpress好用.主题多,插件也非常的便利,而且大多还免费开源.搭建也很简单,其实安装好php+mysql+nginx+wordpress ...

  8. CentOS 7 yum安装LAMP,LNMP并搭建WordPress个人博客网站

    本次实验要进行的是在CentOS7.2,内核版本3.10.0-327.el7.x86_64的环境下搭建LAMP和LNMP,并在此之上做一个WordPress博客网站. [root@Shining ~] ...

  9. 基于Ubunru服务器搭建wordpress个人博客

    一.环境 服务器:阿里云突发性能实例 t5-1核(vCPU) 512 MB + 网络按流量收费(该服务器适用于小型网站) 系统:Ubuntu 22.04 64位Ubuntu  22.04 64位 二. ...

  10. 搭建WordPress 个人博客

    1,准备 LAMP 环境 LAMP 是 Linux.Apache.MySQL 和 PHP 的缩写,是 Wordpress 系统依赖的基础运行环境.我们先来准备 LAMP 环境: (由于部分服务安装过程 ...

随机推荐

  1. sql优化从300秒到7秒

    原始sql select b.jd 街道,b.rglm 楼宇,zzrl 楼宇编号,count(oname) 入楼企业总数, (select count(oname) from ${tablename} ...

  2. JavaWeb乱码问题及统一全站编码(通过Filter实现)

    1. public class CharacterFilter implements Filter { private String characterEncoding = null; FilterC ...

  3. 阿里云-容器服务之集群服务 k8s(Jenkins+gitlab+k8s的devops)- 04

    配置jenkins和gitlab: 1.进入jenkins,新增一个项目,demo-piepeline,创建好,点击配置, 2 .设置镜像地址的命名空间: 3.设置镜像的名字 4.设置代码的分支或者t ...

  4. 步进电机加减速S曲线算法

    一.Sigmoid 函数 1.1 Sigmoid函数原型 1.2 sigmoid函数波形: 由图形可看出在-10时已经接近于0,一般取值区间在[-5,5]. 1.3 sigmoid函数的导数 转载CS ...

  5. 吴裕雄--天生自然MySQL学习笔记:MySQL LIKE 子句

    在 MySQL 中使用 SQL SELECT 命令来读取数据, 同时我们可以在 SELECT 语句中使用 WHERE 子句来获取指定的记录. WHERE 子句中可以使用等号 = 来设定获取数据的条件, ...

  6. 雅可比行列式【2】Jacobian行列式的意义

    2.1 线性变换将面积伸缩 对于一个\(\R^2\to\R^2\)的线性变换: \[ T(x,y)= \left[ \begin{array}{c} 4x-2y\\ 2x+3y \end{array} ...

  7. hdu 2072(字典树模板,set,map均可做)

    地址:http://acm.hdu.edu.cn/showproblem.php?pid=2072 lily的好朋友xiaoou333最近很空,他想了一件没有什么意义的事情,就是统计一篇文章里不同单词 ...

  8. 图论中TSP问题的LINGO求解与应用

    巡回旅行商问题(Traveling Salesman Problem,TSP),也称为货郎担问题.该问题可简单描述为走遍n个城市的最短路.几十年来,出现了很多近似优化算法.如近邻法.贪心算法.最近插入 ...

  9. Spring Cloud Alibaba 教程 | Nacos(六)

    集群模式部署 前面我们已经学习了Nacos作为注册中心.配置中心的相关功能,但是我们之前启动Nacos是通过单实例模式启动的,只适合在学习和开发阶段,生产环境需要保证Nacos的高可用,所以今天我们来 ...

  10. 通过编写c语言程序,运行时实现打印另一个程序的源代码和行号

    2017年6月1日程序编写说明: 1.实现行号的打印,实现代码的读取和输出,理解主函数中的参数含义. 2.对fgets函数理解不够 3.对return(1); return 0的含义理解不够 4.未实 ...