【程序分享】Bolt,一个优秀的轻量级CMS

微魔·程序分享CMS是Content Management System(内容管理系统)的简称,广大博客主比较常听到这个词可能是因为一直为许多极客朋友诟病的那句牢骚“Wordpress越来越像CMS”。常见的CMS,国外的有Drupal,Joomla以及国内的DedeCMS和PHPCMS等,在现在PHP大主流的前提下依然有一些老的ASP程序还在线上,但是退出历史的舞台基本已经大局已定,也许未来的.NET平台会助理新兴的语言吧。言归正传,最近微魔正在搜寻一款轻量级的CMS程序,其中Bolt走入了微魔的视线中,根据官网,Bolt的界面采用了当下流行的“自适应”的设计,在桌面PC,平板和手机上都有良好的界面支持,这也是为什么微魔和大家分享的原因。

开始前,记得关注微魔部落的官方微信哦~实用教程一览无余~

二维码-微魔部落微信账号

1.环境需求

  • PHP 5.3.3以上
  • SQLite,MySQL或PostgreSQL(官方更推荐前两者)
  • Apache或Nginx

2.安装方法

本文不涉及环境设置,环境搭建可参考本站教程区

a.下载并设置权限

curl -O http://bolt.cm/distribution/bolt_latest.tgz
tar -xzf bolt_latest.tgz
chmod -R 777 files/ app/database/ app/cache/ app/config/ theme/

b.设置Bolt

Bolt的管理界面位于http://yourip/bolt

在数据库的选择上,Bolt默认是SQLite(位于app/database),如果需要使用MySQL或PostgreSQL可以修改app/config/config.yml为下面的内容(对应修改数据库名,用户名和密码)

MySQL:

database:
  driver: mysql
  username: bolt
  password: password
  databasename: bolt

PostgreSQL

database:
  driver: postgres
  username: bolt
  password: password
  databasename: bolt

c.设置伪静态

Apache,设置.htaccess如下

# Set the default handler.
DirectoryIndex index.php index.html index.htm

# Prevent directory listing
Options -Indexes

<FilesMatch "\.(yml|db|twig)$">
    Order deny,allow
    Deny from all

  RewriteEngine on

  RewriteRule cache/ - [F]

  # Some servers require the RewriteBase to be set. If so, set to the correct directory.
  # RewriteBase /
  RewriteRule ^thumbs/(.*)$ ./app/classes/timthumb.php [L]

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^ ./index.php [L]

Nginx可修改conf文件如下

# Bolt virtual server
server {
    server_name mycoolsite.com www.mycoolsite.com;
    root /home/mycoolsite.com/public_html;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~* /thumbs/(.*)$ {
        try_files $uri $uri/ /app/classes/timthumb.php?$query_string;
    }

    location /app/classes/upload {
        try_files $uri $uri/ /app/classes/upload/index.php?$query_string;
    }

    location ~* \.(?:ico|css|js|gif|jpe?g|png|ttf|woff)$ {
        access_log off;
        expires 30d;
        add_header Pragma public;
        add_header Cache-Control "public, mustrevalidate, proxy-revalidate";
    }

    location = /robots.txt { access_log off; log_not_found off; }
    location = /favicon.ico { access_log off; log_not_found off; }

    location ~ \.php$ {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param HTTPS off;
    }

    location ~ /\.ht {
        deny all;
    }

    location /app {
        deny all;
    }

    location ~ /vendor {
        deny all;
    }

    location ~ \.db$ {
        deny all;
    }
}

附上官网截图几张~

screenshot4

screenshot8

screenshot1

猜你 喜欢

关于作者: 微魔

小微魔,大智慧!

多条评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注