Wallabag:修订间差异

来自MalacoKnowledge
imported>Malacology
(add tags)
 
(未显示同一用户的3个中间版本)
第7行: 第7行:


<pre># pacman -S mariadb nginx
<pre># pacman -S mariadb nginx
# pacman -S php7 php7-gd php7-tidy php7-intl redis
# pacman -S php-fpm redis
# php7 也可以替换为 php74,需要用 yay,若今后支持php8,可以替换为php
# pacman -S wallabag</pre>
$ yay -S wallabag</pre>此处使用[https://github.com/starsareintherose/GuoyiPackages 我自己的打包],即原来 AUR 的打包
 
== nginx ==
== nginx ==


第45行: 第43行:
         # if, for some reason, you are still using PHP 5,
         # if, for some reason, you are still using PHP 5,
         # then replace /run/php/php7.0 by /var/run/php5
         # then replace /run/php/php7.0 by /var/run/php5
         fastcgi_pass unix:/run/php74-fpm/php-fpm.sock;
         fastcgi_pass unix:/run/php-fpm/php-fpm-wallabag.sock;
         fastcgi_split_path_info ^(.+\.php)(/.*)$;
         fastcgi_split_path_info ^(.+\.php)(/.*)$;
         include fastcgi_params;
         include fastcgi_params;
第72行: 第70行:
<pre>systemctl enable nginx
<pre>systemctl enable nginx
systemctl restart nginx</pre>
systemctl restart nginx</pre>
== mariadb ==
== mariadb ==


第88行: 第87行:
== php ==
== php ==


<pre>cd /etc/php74 或者 /etc/php7 或者 /etc/php
<pre>cd /etc/php
vim php.ini
vim php.ini


第133行: 第132行:
extension=zip</pre>
extension=zip</pre>
<span id="nginx-1"></span>
<span id="nginx-1"></span>
== nginx ==


<pre>vim /etc/nginx/sites-enabled/read.conf.php
配置 <code>/etc/php/php-fpm.d/wallabag.conf</code>
 
<pre>cp /etc/php/php-fpm.d/www.conf /etc/php/php-fpm.d/wallabag.conf</pre>


然后 <code>wallabag.conf</code> 几处 <code>www</code> 替换成 <code>http</code>


server {
<pre>
            listen 80;
[wallabag]
            server_name YOUR_DOMAIN;
user = wallabag
            return 301 https://$server_name$request_uri;
group = wallabag
}
listen = /run/php-fpm/php-fpm-wallabag.sock
server {
</pre>
    listen 443 ssl http2;
    server_name YOUR_DOMAIN;
    root /usr/share/webapps/wallabag/web;
    ssl_certificate YOUR_CRT_FILE;
    ssl_certificate_key YOUR_KEY_FILE;
    ssl_session_cache builtin:1000 shared:SSL:10m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
    ssl_prefer_server_ciphers on;
   
    error_log /var/log/nginx/wallabag_error.log;
    access_log /var/log/nginx/wallabag_access.log;
    location / {
        # try to serve file directly, fallback to app.php
        try_files $uri /app.php$is_args$args;
    }


    location ~ ^/app\.php(/|$) {
        # if, for some reason, you are still using PHP 5,
        # then replace /run/php/php7.0 by /var/run/php5
        fastcgi_pass unix:/run/YOUR_PHP-FPM_DIR/php-fpm.sock; # 注意替换/run/php74-fpm/php-fpm.sock为你的php-fpm地址
        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;
    }
}</pre>
== 配置 ==
== 配置 ==


<pre>cd /usr/share/webapps/wallabag/app/config
<pre>vim /etc/wallabag/parameters.yml</pre>
vim parameters.yml</pre>
设置
设置


第207行: 第165行:
     domain_name: 'https://YOUR_DOMAIN'
     domain_name: 'https://YOUR_DOMAIN'
     server_name: 'Your wallabag instance'
     server_name: 'Your wallabag instance'
     mailer_transport: smtp
     mailer_dsn: 'smtp://127.0.0.1'
    mailer_user: null
    mailer_password: null
    mailer_host: 127.0.0.1
    mailer_port: false
    mailer_encryption: null
    mailer_auth_mode: null
     locale: en
     locale: en
     secret: ANY_SECRET
     secret: ANY_SECRET
第235行: 第187行:
     redis_password: null
     redis_password: null
     sentry_dsn: null</pre>
     sentry_dsn: null</pre>
== 安装 ==
== 安装 ==


<pre>cd /usr/share/webapps/wallabag
<pre>cd /usr/share/wallabag
php bin/console wallabag:install --env=prod
php bin/console wallabag:install --env=prod</pre>
# php可以改为php74,或者相应的php版本
# 第三步一定要新建用户</pre>
清除缓存
清除缓存



2023年7月30日 (日) 07:39的最新版本

wallabag是一个开源免费可自建的稍后读服务。

全文注意替换 YOUR_PASSWORD YOUR_DOMAIN YOUR_PHP-FPM_DIR YOUR_KEY_FILE YOUR_CRT_FILE 并且注意你的php版本以及相关路径。

Install

# pacman -S mariadb nginx
# pacman -S php-fpm redis
# pacman -S wallabag

nginx

configure

cd /etc/nginx/sites-enabled
vim read.conf

add

server {
            listen 80;
            server_name YOUR_DOMAIN;
            return 301 https://$server_name$request_uri;
}
server {
    listen 443 ssl http2;
    server_name YOUR_DOMAIN;
    root /usr/share/webapps/wallabag/web;
    ssl_certificate YOUR_CRT_FILE;
    ssl_certificate_key YOUR_KEY_FILE;
    ssl_session_cache builtin:1000 shared:SSL:10m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
    ssl_prefer_server_ciphers on;
    
    error_log /var/log/nginx/wallabag_error.log;
    access_log /var/log/nginx/wallabag_access.log;
    location / {
        # try to serve file directly, fallback to app.php
        try_files $uri /app.php$is_args$args;
    }

    location ~ ^/app\.php(/|$) {
        # if, for some reason, you are still using PHP 5,
        # then replace /run/php/php7.0 by /var/run/php5
        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;
    }
}

also, I make key for SSL avaiable

systemctl enable nginx
systemctl restart nginx

mariadb

mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
systemctl enable mariadb
systemctl restart mariadb
mysql_secure_installation
mysql -u root -p
CREATE DATABASE wallabag;
use wallabag;
CREATE USER 'wallabag'@'localhost' IDENTIFIED BY 'YOUR_PASSWARD'
GRANT ALL PRIVILEGES ON `wallabag`.* TO 'wallabag'@'localhost'; 
FLUSH PRIVILEGES; 
exit
systemctl restart mariadb

php

cd /etc/php
vim php.ini

# 删除相应extension前的;

extension=bcmath
;extension=bz2
;extension=calendar
extension=curl
;extension=dba
;extension=enchant
;extension=exif
;extension=ffi
;extension=ftp
extension=gd
;extension=gettext
;extension=gmp
extension=iconv
;extension=imap
extension=intl
;extension=ldap
extension=mysqli
;extension=odbc
;zend_extension=opcache
;extension=pdo_dblib
extension=pdo_mysql
;extension=pdo_odbc
;extension=pdo_pgsql
;extension=pdo_sqlite
;extension=pgsql
;extension=pspell
;extension=shmop
;extension=snmp
;extension=soap
extension=sockets
;extension=sodium
;extension=sqlite3
;extension=sysvmsg
;extension=sysvsem
;extension=sysvshm
extension=tidy
extension=xmlrpc
;extension=xsl
extension=zip

配置 /etc/php/php-fpm.d/wallabag.conf

cp /etc/php/php-fpm.d/www.conf /etc/php/php-fpm.d/wallabag.conf

然后 wallabag.conf 几处 www 替换成 http

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

配置

vim /etc/wallabag/parameters.yml

设置

# This file is auto-generated during the composer install
parameters:
    database_driver: pdo_mysql
    database_host: 127.0.0.1
    database_port: 3306
    database_name: wallabag
    database_user: wallabag
    database_password: YOUR_PASSWORD
    database_path: /var/lib/mysql/wallabag
    database_table_prefix: wallabag_
    database_socket: null
    database_charset: utf8mb4
    domain_name: 'https://YOUR_DOMAIN'
    server_name: 'Your wallabag instance'
    mailer_dsn: 'smtp://127.0.0.1'
    locale: en
    secret: ANY_SECRET
    twofactor_auth: true
    twofactor_sender: [email protected]
    fosuser_registration: true
    fosuser_confirmation: true
    fos_oauth_server_access_token_lifetime: 3600
    fos_oauth_server_refresh_token_lifetime: 1209600
    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

安装

cd /usr/share/wallabag
php bin/console wallabag:install --env=prod

清除缓存

php bin/console cache:clear --env=prod

安装时设置用户