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:\code\blog" ServerName www.blog.com <Directory "H:\code\blog"> 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-content\plugins\
找到db.php,復制到到wordpress安裝目錄下的wp-content目錄中
7.運行並配置博客,開始你的wordpress博客之旅吧
