博客新框架Flatpress尝试
2024-03-16 22:20:09

前言

前几天购入了一台VPS,搭建好了Halo2.0博客框架,自己和朋友都觉得挺满意的,比起以前Github上托管hexo搭建的静态博客不管是从写博客还是维护博客都方便了许多。但是还没过几天,可能是装了一款向搜索引擎推送url的插件,由于我每天只能向微软推送十条url,导致后续的url都推送失败,而默认的推送设置是每隔360分钟推送一次,导致程序陷入了死循环,造成了vps卡顿,网站也打不开了,而且,就在我写博客的时候,网站还是打不开。所以,我开始寻找下一个博客框架,我看到云风大佬应该是装的应该是Flatpress框架,自己也想试试,折腾折腾,一直没装成功,网络上中文的教程也很少,基本是翻译了官网的三句话教程

  1. Unzip FlatPress package and upload to your web server
  2. Browse to your web server, insert your data into the FlatPress installer
  3. Enjoy blogging with FlatPress!

对于我这样的小白来说根本不够,不过,Vultr倒是给出了直接可以复制粘贴的教程Install FlatPress CMS on Ubuntu 20.04 LTS,我这边简单复制一下,再加上一些汉化、修改的东西。

安装框架

1. Install LAMP Server

Update system package manager.

1
sudo apt update

Add the ppa:ondrej/php PPA repository.

1
2
sudo apt -y install software-properties-common
sudo add-apt-repository ppa:ondrej/php

Update system package manager.

1
sudo apt update

Install PHP 7.4 and extra packages.

1
sudo apt install apache2 php7.4 libapache2-mod-php7.4 php7.4-common php7.4-sqlite3 php7.4-json php7.4-curl php7.4-intl php7.4-mbstr

List available time zones and choose your preference.

1
sudo timedatectl list-timezones

Edit the PHP configuration file.

1
sudo nano /etc/php/7.4/apache2/php.ini

Change the following values, and replace Africa/Nairobi with your timezone save and close the file:

To search for a specific line, use Control + W, enter search phrase then press Enter

1
2
3
4
5
6
max_execution_time = 600    
memory_limit = 256M
upload_max_filesize = 100M
post_max_size = 100M
max_input_time = 600
date.timezone = Africa/Nairobi

2. Install FlatPress

Download the latest FlatPress installation files. To find the latest version, visit release page.

1
wget https://github.com/flatpressblog/flatpress/archive/1.2.1.zip

Create the installation directory /var/www/html/flatpress.

1
sudo mkdir /var/www/html/flatpress

Extract the downloaded files.

1
sudo unzip 1.2.1.zip

Move the files to the installation directory.

1
sudo mv flatpress-1.2.1/* /var/www/html/flatpress

Change ownership of the installation directory.

1
sudo chown -R www-data:www-data /var/www/html/flatpress/

Change access permissions for the directory.

1
sudo chmod -R 755 /var/www/html/flatpress/

3. Configure Apache2

Create a new configuration file named flatpress.conf.

1
sudo vim /etc/apache2/sites-available/flatpress.conf

Add the content below into the file and save it:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/flatpress
ServerName example.com
ServerAlias www.example.com

<Directory /var/www/html/flatpress/>
Options FollowSymlinks
AllowOverride All
Require all granted
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

<Directory /var/www/html/flatpress/>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*) index.php [PT,L]
</Directory>
</VirtualHost>

Change to Apache configuration files directory.

1
cd /etc/apache2/sites-available/

Enable the created virtual host configuration.

1
sudo a2ensite flatpress.conf

Disable the default Apache configuration.

1
sudo a2dissite 000-default.conf

Enable the Apache rewrite module.

1
sudo a2enmod rewrite

Restart Apache service for the changes to take effect.

1
sudo systemctl restart apache2

4. Access FlatPress Web Interface

Open your web browser and browse to http://Server_IP. For example:

1
http://192.0.2.10/

至此,Flatpress框架已经安装完成,剩下的工作就是用反代工具,使用域名访问博客网址了。

Flatpress博客美化

1. 下载中文语言包

直接用wget下载语言包,将fp-interface文件中的zh-cn文件夹移动到/var/www/html/flatpress/fp-interface/lang文件夹就行了

2. 删除footer

就是博客最底下的This blog is proudly powered by FlatPress.
只需要找到flatpress/fp-interface/themes/leggero/footer.tpl文件,简单粗暴地把这行删除即可

3. 其他

剩下的例如修改主页部件、修改博客名等操作和别的博客框架类似,这里不再赘述了。

Prev
2024-03-16 22:20:09
Next