Wallabag

来自 ArchWiki

wallabag 是一个用于保存网页的自托管应用程序。

安装

安装 wallabag 软件包。

配置

PHP

配置 php 以允许 wallabag 在 /usr/share/wallabag 中工作,并使用 /etc/wallabag/parameters.yml 配置 wallabag。

给予 wallabag 用户写入 /usr/share/wallabag/var/cache/prod/ 的权限

所需 php 模块的列表可以在这里找到。 以下代码段是为了简洁起见而提供的。

/etc/php/conf.d/wallabag.ini
extension=bcmath
extension=gd
extension=gettext
extension=iconv
extension=intl
extension=tidy

; database - sqlite
;extension=pdo_sqlite
;extension=sqlite3

; database - pgsql
;extension=pdo_pgsql
;extension=pgsql

Wallabag

一旦 wallabag 被正确配置,必须以 wallabag 用户身份运行命令,以便初始化数据库和应用程序状态。

提示: 通过将 --env=prod 附加到命令来确保设置了所需的环境。
[wallabag]$ cd /usr/share/wallabag
[wallabag]$ php bin/console cache:clear
[wallabag]$ php bin/console wallabag:install
注意: 当更改 /etc/wallabag/parameters.yml 时,必须清除缓存。

数据库

支持的数据库有

此处未涵盖安装和配置。

应用服务器

php-fpm

建议复制 /etc/php/php-fpm.d/www.conf 并对其进行修改。 如果您想使用它,则必须将 listen 更改为与 /run/php-fpm/php-fpm.sock 不同的值

/etc/php/php-fpm.d/wallabag.conf
[wallabag]

user = wallabag
group = wallabag
listen = /run/php-fpm/php-fpm-wallabag.sock

Web 服务器

nginx

以下配置来源于上游文档,并根据自定义 php-fpm 配置进行了轻微的修改和调整

/etc/nginx/example.conf
server {
    server_name domain.tld www.domain.tld;
    root /usr/share/wallabag/web;

    location / {
        # try to serve file directly, fallback to app.php
        try_files $uri /app.php$is_args$args;
    }
    location ~ ^/app\.php(/|$) {
        fastcgi_pass unix:/run/php-fpm/php-fpm-wallabag.sock;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        # When you are using symlinks to link the document root to the
        # current version of your application, you should pass the real
        # application path instead of the path to the symlink to PHP
        # FPM.
        # Otherwise, PHP's OPcache may not properly detect changes to
        # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
        # for more information).
        fastcgi_param  SCRIPT_FILENAME  $realpath_root$fastcgi_script_name;
        fastcgi_param DOCUMENT_ROOT $realpath_root;
        # Prevents URIs that include the front controller. This will 404:
        # http://domain.tld/app.php/some-path
        # Remove the internal directive to allow URIs like this
        internal;
    }

    # return 404 for all other php files not matching the front controller
    # this prevents access to other php files you don't want to be accessible.
    location ~ \.php$ {
        return 404;
    }

    error_log /var/log/nginx/wallabag_error.log;
    access_log /var/log/nginx/wallabag_access.log;
}

其他 Web 服务器的通用配置可以在上游找到。

故障排除

版本升级

有可用的升级说明,具体取决于旧版本和新版本。 通常,必须由 wallabag 用户清除缓存并执行数据库迁移,如下所示。

提示: 通过将 --env=prod 附加到命令来确保设置了所需的环境。
[wallabag]$ cd /usr/share/wallabag
[wallabag]$ php bin/console cache:clear
[wallabag]$ php bin/console doctrine:migrations:migrate

参见