跳转至内容

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

参见