前言
如果你使用过Firefox,那么你对Pocket一定不陌生。与Pocket类似,Wallabag是用来保存网页的开源自托管应用,主要功能就是将要阅读或者一时没有读完的文章同步到Wallabag服务器,供使用者在以后阅读。更多信息请访问官网 https://wallabag.org/ 。当然如果你没有自己的服务器,可以考虑使用 wallabag.it 托管解决方案。
我平时在网上阅读到有意思或者没读完的文章时,一般会保存在Chrome的书签或者直接收藏在Telegram,虽然同步是可以同步,但感觉还是有点别扭,Google一番终于找到了这个神器,我已经将它作为稍后阅读的生产力工具使用。同时,也可以将书签存在上面。虽然Wallabag在配置难度、界面体验上与一些商业软件相比略有逊色,但依然值得一试。
Wallabag具有以下特性:
- 开源 PHP 程序,易托管,github地址:https://github.com/wallabag/wallabag
- 界面美观,易于阅读
- 浏览器插件 - 一键保存网页到服务
- 开放的 API - 可以根据 API 自由编写客户端
- 迁移 - 从 Pocket, Readability, Instapaper 或 Pinboard 服务导入数据
- 导出 - 可以导出文章到 epub, mobi, pdf 等格式
- 随处可用 - 由于是 Web 服务,可以在使用浏览器的系统上使用,同时支持 Android 客户端
- RSS 阅读器兼容
- 保存网页不受源限制,源网页删除后依旧可以阅读
先来一张完成图:
ps:搭建Wallabag之前请配置好相关环境,博主所用系统为Debian 9 ,已安装了 OneinStack
安装comopser
curl -s https://getcomposer.org/installer | php
之后可以就通过 php composer.phar
来运行composer了
OneinStack安装php扩展
请阅读 文档 以查看 Wallabag 安装依赖。
我是用的 OneinStack,与apt不同,这里以安装tidy为例
apt install libtidy-dev ## 必须库
cd /root/oneinstack/src
tar zxvf php-7.3.5.tar.gz ## 解压已经安装的php版本
cd php-7.3.5/ext/tidy
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
cd /usr/local/php/lib/php/extensions
ls ## 看到no-debug-non-zts-20180731类似文件夹
cd no-debug-non-zts-20180731
ls ## 查看有没有 tidy.so,如果有,证明编译成功
加载 tidy
echo 'extension=tidy.so' > /usr/local/php/etc/php.d/ext-tidy.ini
开启被禁函数
在 /usr/local/php/etc/php.ini
中搜索 disable_functions
删除以下函数:
- shell_exec()
- proc_open()
- exec()
- proc_get_status ()
为Wallabag创建数据库和用户
常规操作,phpmyadmin和命令行都行,这里使用命令行
mysql -u root -p
MySQL [(none)]> CREATE DATABASE wallabag;
MySQL [(none)]> CREATE USER [email protected];
MySQL [(none)]> SET PASSWORD FOR [email protected]= PASSWORD("123456");
MySQL [(none)]> GRANT ALL PRIVILEGES ON wallabag.* TO [email protected] IDENTIFIED BY '123456';
MySQL [(none)]> FLUSH PRIVILEGES;
MySQL [(none)]> \q
下载Wallabag
首先在 Github 下载 Wallabag
git clone https://github.com/wallabag/wallabag
checkout最新分支,我安装时是2.3.8:
$ cd wallabag/
$ git checkout 2.3.8
Note: checking out '2.3.8'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at 9bbafdaa... Release wallabag 2.3.8
配置Wallabag
在目录中继续输入
SYMFONY_ENV=prod php composer.phar install --no-dev -o --prefer-dist
SYMFONY_ENV=prod
告诉symfony我们正在生产环境中安装Wallabag。该 --no-dev
标志确保在生产环境中不安装任何开发包。composer将下载并安装所有必需的依赖项。--prefer-dist
表示下载zip包而不是直接clone。
之后会要求配置一些东西,根据提示操作就好:
数据库
我用的mysql
Creating the "app/config/parameters.yml" file
Some parameters are missing. Please provide them.
database_driver (pdo_mysql): ## 我用的mysql,直接回车
database_host (127.0.0.1): localhost## 自定义
database_port (null): ## 自定义
database_name (wallabag): ## 数据库名
database_user (root): ## 数据库用户名
database_password (null): ## 数据库密码
database_path (null): ## 路径
database_table_prefix (wallabag_): ## 前缀
database_socket (null): ## 自定义
database_charset (utf8mb4): ## 自定义
domain_name ('https://your-wallabag-url-instance.com'): https://mark.spiritx.xyz ## 域名
邮箱设置
看需求,我是个人使用,没配置邮箱
mailer_transport (smtp):
mailer_user (null):
mailer_password (null):
mailer_host (127.0.0.1):
mailer_port (false):
mailer_encryption (null):
mailer_auth_mode (null):
locale (en):
secret (CHANGE_ME_TO_SOMETHING_SECRET_AND_RANDOM):
twofactor_auth (true):
twofactor_sender ([email protected]):
fosuser_registration (true):
fosuser_confirmation (true):
from_email ([email protected]):
杂项设置
默认就好
rss_limit (50):
rabbitmq_host (localhost):
rabbitmq_port (5672):
rabbitmq_user (guest):
rabbitmq_password (guest):
rabbitmq_prefetch_count (10):
redis_scheme (tcp):
redis_host (localhost):
redis_port (6379):
redis_path (null):
redis_password (null):
sentry_dsn (null):
安装Wallabag
完成前面的步骤后,开始Wallabag的安装,输入下面命令
php bin/console wallabag:install --env=prod
之后如下:
Wallabag installer
==================
Step 1 of 4: Checking system requirements.
------------------------------------------
------------------------ -------- ----------------
Checked Status Recommendation
------------------------ -------- ----------------
PDO Driver (pdo_mysql) OK!
Database connection OK!
Database version OK!
curl_exec OK!
curl_multi_init OK!
------------------------ -------- ----------------
[OK] Success! Your system can run wallabag properly.
Step 2 of 4: Setting up database.
---------------------------------
It appears that your database already exists. Would you like to reset it? (yes/no) [no]:
>
Creating schema...
Clearing the cache...
Database successfully setup.
Step 3 of 4: Administration setup.
----------------------------------
Would you like to create a new admin user (recommended)? (yes/no) [yes]:
>
Username [wallabag]:
> spirit ## 输入用户名
Password [wallabag]:
> ## 输入密码(不会显示)
Email [[email protected]]:
> ## 输入邮箱(随便啦,反正我没配置邮件服务器
Administration successfully setup.
Step 4 of 4: Config setup.
--------------------------
Config successfully setup.
[OK] Wallabag has been successfully installed.
[OK] You can now configure your web server, see https://doc.wallabag.org
装完把Wallabag移动到域名目录,别忘了 chown -R www.www ./*
,防止出现api访问错误
配置Nginx
完成后访问 web
目录下的 app.php
就能使用了,但我觉得这样不好看,于是重新写了下Nginx
将 index index.php;
修改为 index app.php;
将 root /data/wwwroot/mark.spiritx.xyz;
修改为 root /data/wwwroot/mark.spiritx.xyz/web;
增加一个块
location / {
try_files $uri /app.php$is_args$args;
}
重庆Nginx之后直接访问域名 mark.spiritx.xyz 就能使用啦
后记
Wallabag提供了浏览器插件和手机app,可以更方便的访问Wallabag,下面以chrome扩展为例
点击 API clients management
后再点击Create a new client
创建一个api
在扩展中填入刚才创建的api的信息,保存
之后就能愉快地使用啦~ ~
附地址:
Firefox addon: https://addons.mozilla.org/firefox/addon/wallabagger/
Chrome addon: https://chrome.google.com/webstore/...
Opera addon: https://addons.opera.com/en/extensions/details/wallabagger/?display=en
Android: via F-Droid / via Google Play
iOS: https://itunes.apple.com/app/wallabag-2/id1170800946?mt=8
Windows Phone: https://www.microsoft.com/store/apps/wallabag/9nblggh11646
Comments | 7 条评论
我又来啦~网站基本弄好了,可以交换下友链吗
请问,部署完成之后,打开的网页只有文字,不显示图片,这是哪方面的原因呢?
@vksir F12看看控制台有无报错,报错信息是什么
@Spirit 原因是css未加载,原来是我域名填错了。
感谢~
@vksir www.vksir.zone 这是我的网站,嘻嘻~
感谢,按照教程已经部署成功。
@Aaron 对你有帮助就好
