基于WordPress博客系统搭建

环境准备

本系统将基于LNMP进行搭建,LNMP系统搭建准备请参考博主另外两篇文章
https://blog.csdn.net/gao36951/article/details/73321345
https://blog.csdn.net/gao36951/article/details/89702602
环境版本信息

  • linux 版本

在这里插入图片描述

  • nginx 版本
    在这里插入图片描述
  • mysql版本
    在这里插入图片描述
  • php版本
    在这里插入图片描述
  • WordPress版本
    在这里插入图片描述
    在这里插入图片描述
    Tips:
    本来php和WordPress打算用最新的版本的,到最后一直报mysql依赖未安装,安装网上的方式,各种都试了不行。而且PHP直接连写代码连mysql用下面的两种方式都不行,后来不得不退而求其次,选了低一点的版本。
<?php
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
?>
<?php
$con = mysqli_connect("localhost","peter","abc123");
if (!$con)
  {
  die('Could not connect: ' . mysqli_error());
  }
?>

开始安装

这里简单说一下在安装php5.6时候遇到的问题

./configure --prefix=/usr/local/php5.6 --with-mysql=mysqlnd \
--with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-openssl --enable-fpm \
--enable-sockets --enable-sysvshm --enable-mbstring --with-freetype-dir --with-jpeg-dir \
--with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --with-mhash \
--with-mcrypt=/usr/local/libmcrypt --with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d --with-bz2 --enable-maintainer-zts

报错

checking for mcrypt support... yes
configure: error: mcrypt.h not found. Please reinstall libmcrypt.

解决方案

yum install -y libmcrypt-devel

安装WordPress
到这里去下载对应版本的 tar.gz 包https://cn.wordpress.org/download/releases/
本例子为5.0版本。
在linux里面直接下载可以先找到对应包的下载路径使用下面命令下载,注意要下载到非用户主目录下,以避免不需要的麻烦。

wget https://cn.wordpress.org/wordpress-5.0-zh_CN.tar.gz

本示例安装路径为/project/wordpress

  • 首先切换到此目录
cd /project/wordpress
wget https://cn.wordpress.org/wordpress-5.0-zh_CN.tar.gz
  • 解压安装包
tar -zxvf wordpress-5.0-zh_CN.tar.gz
  • 将wordpress授权nginx
chown -R nginx:nginx ./wordpress
  • 配置nginx,可以从网上找一个favicon.ico放到/project/wordpress/wordpress目录下
 server {
     listen       80;
     server_name  localhost;
     include /etc/nginx/default.d/*.conf;
     location / {
 	   root  /project/wordpress/wordpress;
	   index index.php;
     }
	 location  /favicon.ico { 
 	   root  /project/wordpress/wordpress;
	 }
	 location ~ \.php$ {
 	   root           /project/wordpress/wordpress;
   	   fastcgi_pass   127.0.0.1:9000;
           fastcgi_index  index.php;
    	   fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    	   include        fastcgi_params;
       }
        error_page 404 /404.html;
            location = /40x.html {
        }
        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }
  • 配置好重启nginx
nginx -s reload

然后浏览器直接输入你的域名(需要nginx配置)IP地址,如下图所示说明WordPress成功,后续可以自己随意发挥了~
在这里插入图片描述
参考
https://www.cnblogs.com/smyhvae/p/4965163.html
https://blog.csdn.net/qq_29058883/article/details/78106514
https://blog.51cto.com/xpleaf/1903115
https://www.jianshu.com/p/68f852b922b5

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值