怎么让wordpress用sqlite3 搭建轻量级博客系统

wordpress 默认是用mysql作为数据库支持,这个对个人站长来说还是有点麻烦了些。特别是如果以后网站备份迁移就有点事多了。

之前用django开发自己的博客感觉其实用sqlite3作为数据库插好,就是一个文件而已。备份网站,直接打包整个目录即可方便省事。

那么作为个人站长,如果要用wordpress和sqlite3来建设网站的话怎么搞呢?这里在windows环境我试了一下,可行方便。如果是生产环境,请自要百度linux安装wordpress教程。

1.自行搭建php运行环境(如果你是小白,且是windows系统,我推荐使用phpstudy

2.下载wordpress

3.下载SQLite Integration 插件

解压下载的wordpress压缩包到任意目录

4、配置phpstudy的apache

<VirtualHost *:80>
    DocumentRoot "H:codelog"
    ServerName www.blog.com
  <Directory "H:codelog">
      Options Indexes FollowSymLinks ExecCGI
      AllowOverride All
      Order allow,deny
      Allow from all
      Require all granted
  </Directory>
</VirtualHost>

如果是nginx手动修改nginx.conf文件。增加一个server即可

server {
    listen  80;
    server_name www.herostore.cn;
    set $root_path 'c:/laravel/';
    root $root_pa
    index index.php index.html index.htm;
    location / {
    try_files $uri $uri/ /index.php?$query_string;
    }
    location ~ .php(.*)$  {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_split_path_info  ^((?U).+.php)(/?.+)$;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    fastcgi_param  PATH_INFO  $fastcgi_path_info;
    fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
    include        fastcgi_params;
    }
    location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
    }
    location ~ /.ht {
        deny all;
    }
}

5、将目录下的wp-config-sample.php复制粘贴一份重命名为wp-config.php

打开wp-config.php修改以下配置

// ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
/** WordPress数据库的名称 */
define('DB_NAME', 'MyBlog');//MyBlog<====这是数据库名,可以自定义
/** MySQL数据库用户名 */
define('DB_USER', '');
/** MySQL数据库密码 */
define('DB_PASSWORD', '');
/** MySQL主机 */
define('DB_HOST', 'localhost');
/** 创建数据表时默认的文字编码 */
define('DB_CHARSET', 'utf8');
/** 数据库整理类型。如不确定请勿更改 */
define('DB_COLLATE', '');
//define('WP_ALLOW_REPAIR', true);//数据库修复时使用
define('DB_TYPE', 'sqlite');    //mysql or sqlite`

6、解压SQLite Integration到wordpress安装目录下wp-contentplugins

找到db.php,复制到到wordpress安装目录下的wp-content目录中

7.运行并配置博客,开始你的wordpress博客之旅吧

QQ群交流:697028234

原文地址:https://www.cnblogs.com/draculaqk/p/8430472.html