搭建WordPress个人博客
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个人博客的更多相关文章
- WordPress 建站教程:新手搭建 WordPress个人博客图文教程(完全版)
前言 WordPress 作为动态博客的代表,至今已经有十几年历史,而且一直在更新发展中,功能强大,插件和主题丰富,WordPress搭建使用也很方便.作为个人站长和博主,很多都是从 WordPres ...
- 腾讯云-搭建 WordPress 个人博客
搭建 WordPress 个人博客 准备 LNMP 环境 任务时间:30min ~ 60min LNMP 是 Linux.Nginx.MySQL 和 PHP 的缩写,是 WordPress 博客系统依 ...
- 基于 CentOS 搭建 WordPress 个人博客
欢迎大家前往腾讯云+社区,获取更多腾讯海量技术实践干货哦~ 腾讯云提供了开发者实验室帮助用户搭建 WordPress 个人博客,教程内容如下,用户可以点击开发者实验室快速上机完成实验. 准备 LNMP ...
- 基于Ubuntu 搭建 WordPress 个人博客 - 开发者实验室 - 腾讯云
1.准备 LAMP 环境 安装 Apache2 在终端输入该命令 ,使用 apt-get 安装 Apache2: sudo apt-get install apache2 -y 安装好后,您可以通过访 ...
- Debian 8.9 搭建wordpress个人博客
想自己搭个博客玩玩,就搭建了此博客,过程可谓艰辛啊! 先在阿里云买了个 轻量应用服务器 1个月10块钱,好贵.... 用 windows sever 下载不了phpstudy,也不知道怎么回事... ...
- 5分钟搭建wordpress个人博客网站——宝塔傻瓜式部署,无坑系列,附赠主题和md插件[2021-12-31]
一.前言 自从买了服务器,小编已经马不停蹄的学了两天服务搭建的知识,问了很多大佬,快速搭建自己的博客网站.有四种方式,我在这里全部分享给大家.自己已经搭建好,欢迎大家过来看一下,给你提供个思路哈! 小 ...
- 在服务器上搭建wordpress个人博客 php7.2+nginx+mysql+wordperss
买了台VPS,准备搭建一个博客.用过几个博客框架还是觉得Wordpress好用.主题多,插件也非常的便利,而且大多还免费开源.搭建也很简单,其实安装好php+mysql+nginx+wordpress ...
- CentOS 7 yum安装LAMP,LNMP并搭建WordPress个人博客网站
本次实验要进行的是在CentOS7.2,内核版本3.10.0-327.el7.x86_64的环境下搭建LAMP和LNMP,并在此之上做一个WordPress博客网站. [root@Shining ~] ...
- 基于Ubunru服务器搭建wordpress个人博客
一.环境 服务器:阿里云突发性能实例 t5-1核(vCPU) 512 MB + 网络按流量收费(该服务器适用于小型网站) 系统:Ubuntu 22.04 64位Ubuntu 22.04 64位 二. ...
- 搭建WordPress 个人博客
1,准备 LAMP 环境 LAMP 是 Linux.Apache.MySQL 和 PHP 的缩写,是 Wordpress 系统依赖的基础运行环境.我们先来准备 LAMP 环境: (由于部分服务安装过程 ...
随机推荐
- 3,Structured Streaming使用checkpoint进行故障恢复
使用checkpoint进行故障恢复 如果发生故障或关机,可以恢复之前的查询的进度和状态,并从停止的地方继续执行.这是使用Checkpoint和预写日志完成的.您可以使用检查点位置配置查询,那么查询将 ...
- 使用Docker构建基于centos7镜像的python环境
Dcokerfile配置信息 ############################################## # 基于centos7构建python3运行环境 # 构建命令: 在Dock ...
- .pcd格式点云文件的显示
利用pcl_viewer工具pcl_viewer rtabmap_cloud.pcd
- mysql float 这个大坑
以后高精度的数据不要用这个字段 今天同事反应 应该是17390.7的数据 结果展示17390.6992 找了半天问题在哪 后来决定先不管 手动现在数据库改数据 结果手动改也改不过来 于是能确定 ...
- Redis 在NETCore中的应用
Redis 在NETCore中的应用 Redis 在netFramework中的应用 也一样 新建.NETCORE(webapi)项目 安装NuGet //查询NuGet语句 Find-Packag ...
- post表单、json接口
package com.lv.qggz.man.dhht.api.typesetting; import com.lv.qggz.man.dhht.api.typesetting.vo.UVO;imp ...
- js对象属性名和属性值生成新数组时都作为属性值
const obj = { id:1, name:'zhangsan', age:18 } const arr = []; Object.getOwnPropertyNames(obj).forEac ...
- 吴裕雄--天生自然MySQL学习笔记:MySQL 排序
从 MySQL 表中使用 SQL SELECT 语句来读取数据. 如果我们需要对读取的数据进行排序,我们就可以使用 MySQL 的 ORDER BY 子句来设定你想按哪个字段哪种方式来进行排序,再返回 ...
- 销售de经典语录
[销售的境界] 1.顾客要的不是便宜,而是感觉上占了便宜: 2.不要与顾客争论价格,要与顾客讨论价值: 3.没有不对的客户,只有不够好的服务: 4.卖什么不重要,重要的是怎么卖: 5.没有最好的产品, ...
- VC调用VB写的COM
VB. 步骤: 1.创建类库:类库的创建必须分为接口和实现类:给外面提供的是COM接口: 创建了接口和类之后还要创建"Guid",这个在"工具->创建GUID&qu ...