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. java 微信红包算法代码实现及架构设计

    转载至:https://www.zybuluo.com/yulin718/note/93148 微信红包的架构设计简介 架构 @来源于QCon某高可用架构群整理,整理朱玉华. 背景:有某个朋友在朋友圈 ...

  2. h5-transform二维变换

    1.html <div class="translate">1</div> <div class="scale">2< ...

  3. 工程日记之ChildLost(1):URLSession

    URLSession 是什么 URL Loading System提供了访问URL资源的系统,提供了访问http/https/自定义URL访问的接口.其中,URLSession实例可以创建多个URLS ...

  4. 【mui webAPP】HBuilder创建的iOS平台设置沉浸式状态栏

    应用占用全屏区域,而系统状态栏需要预留出系统状态栏高度. HBuilder创建的应用默认不使用沉浸式状态栏样式,需要进行如下配置开启:打开应用的manifest.json文件,切换到代码视图,在plu ...

  5. 2019年春PAT甲级考试

    这次考试不是很理想,一道题目没能做完. 自己原因差不多三条: 1.自己实力不够,准备时间也有点仓促,自己没能做到每道题目都有清晰的思路. 2.考试的心理素质不行,因为设备原因东奔西跑浪费了挺多时间,自 ...

  6. 详细的git入门级别,从安装到实战

    拥有自己码云开源网站,想要上传项目到码云怎么操作?公司新技术提升由Svn转为Git,慌不慌?想要从Github开源网站下载开源项目,难道还依赖直接下载项目然后解压导入项目工程?下面可以通过及其简易且好 ...

  7. Dynamics CRM - 在 Dynamics CRM 开发中创建一个 Entity 对象

    在 Dynamics CRM 的开发中,我们时不时需要创建 Entity 对象,而对于如何创建 Entity 对象,在 C# plugin 和 JS 的写法存在些许差异. 一.C# Plugin 创建 ...

  8. Python说文解字_杂谈03

    1. 我们从前面的知识得到,所有的类都要继承自object这个基类(超类),另外我们知道“继承”可以继承类的属性和方法.我们起始通过type创建类的时候,自然而然的也会从ojbect继承他的一些属性和 ...

  9. Python7DAY-基础语法.md

    # python简介 python交互器的作用:主要是是为了调试代码.

  10. 后台用Hbase对表单数据实现增删改查遇到的问题

    1.无法解析jsp 原因:hbase中lib下jar包会与tomcat包冲突,需要删除与tomcat冲突的包 这是我删除的几个包 之后运行就没有问题了 2.对于Hbase修改的问题 在添加数据时,HB ...