搭建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 环境: (由于部分服务安装过程 ...
随机推荐
- flink和spark Streaming中的Back Pressure
Spark Streaming的back pressure 在讲flink的back pressure之前,我们先讲讲Spark Streaming的back pressure.Spark Strea ...
- VS2013 配置Mysql
1.添加mysql.h 对着项目右键,选择properties 双击C/C++,选择General,看到Additional Include Directories 编辑 点击文件夹的按钮 点击... ...
- ORACLE常见问题收集
1.Java代码执行oracle,update和insert语句卡住不动 解决方法:造成这样的情况原因在于你之前执行了update或insert操作但你并没有commit,导致你操作的这条记录被ora ...
- ES7之async/await
async 是 ES7 才有的与异步操作有关的关键字. async 函数返回一个 Promise 对象,可以使用 then 方法添加回调函数. async function helloAsync(){ ...
- python期末考试复习
期末考试复习 补修的python跟着大一一起学,考试肯定不会出难,于是就敲了一些代码,把他们放到博客上,来记录一下 代码都是一段一段的,且python代码不是很多,所以我都写到了一个文件里,作为练习 ...
- 微信小程序常用代码(1)——tab切换
<view class="font-bold tab-content"> <!-- 循环列表 --> <block wx:for=&quo ...
- 吴裕雄--天生自然 PHP开发学习:For 循环
<?php for ($i=1; $i<=5; $i++) { echo "The number is " . $i . "<br>"; ...
- AI 领域与概述
概述 数据分析行业主要的职业发展. 业务:业务分析师.数据产品经理.产品总监 技术:算法师.架构师.研发经理.研发总监 美工:BI工程师 人工智能,是数据分析的子集.人工智能主要包括 语音识别 自然语 ...
- mybatis连接mysql(jdbc)常见问题
问题1:java.io.IOException: Could not find resource com/xxx/xxxMapper.xml IDEA是不会编译src的java目录的xml文件,所以在 ...
- 插曲 强大的神器 vmware
电脑到了 这连天给电脑配环境变量 真的想死 发现用 虚拟机 直接跑别人配置好的镜像文件 多快好省超级开心 比较毒瘤的 clion 不仅要配置c++ 环境 还要走cmake 等一堆东西 ...