Wallabag是用来保存网页的开源自托管应用,是类似Pocket的开源实现。主要功能就是将你要阅读或者一时没有读完的文章同步到Wallabag服务器,供你在以后阅读。
- Wallabag源代码:https://github.com/wallabag/wallabag
Arch Linux安装Wallabag
首先安装LEMP:Arch Linux 安装 LEMP (Nginx, MariaDB, PHP7)
为Wallabag创建数据库:
1 |
mysql -u root -p |
1 2 3 4 5 6 |
create database wallabag; create user wallabag_user@localhost; set password for wallabag_user@localhost= password("test1234"); grant all privileges on wallabag.* to wallabag_user@localhost identified by 'test1234'; flush privileges; exit; |
下载Wallabag:
1 2 3 |
git clone https://github.com/wallabag/wallabag.git cd wallabag # 使用git checkout切换版本 |
配置PHP,开启扩展:
1 |
sudo vim /etc/php/php.ini |
1 2 3 4 5 6 7 |
extension=bcmath.so extension=curl.so extension=gd.so extension=iconv.so extension=mysqli.so extension=pdo_mysql.so extension=zip.so |
重启php-fpm:
1 |
sudo systemctl restart php-fpm |
安装composer:
1 |
sudo pacman -S composer |
安装Wallabag:
1 |
SYMFONY_ENV=prod composer install --no-dev -o --prefer-dist |
回答一些参数完成app/config/parameters.yml文件的创建:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
Creating the "app/config/parameters.yml" file Some parameters are missing. Please provide them. database_driver (pdo_sqlite): pdo_mysql database_host (127.0.0.1): 127.0.0.1 database_port (null): 3306 database_name (symfony): wallabag database_user (root): wallabag_user database_password (null): test1234 database_path ('%kernel.root_dir%/../data/db/wallabag.sqlite'): /var/lib/mysql/wallabag database_table_prefix (wallabag_): wallabag_ database_socket(null): Press Enter mailer_transport (smtp): mailer_host (127.0.0.1): mailer_user (null): mailer_password (null): locale (en): secret (ovmpmAWXRsdafsdgzlzFsadfYmCFfzGv): twofactor_auth (true): twofactor_sender (no-reply@wallabag.org): fosuser_confirmation (true): from_email (no-reply@wallabag.org): |
运行如下命令设置数据库和管理员用户:
1 |
php bin/console wallabag:install --env=prod |
把wallabag移动到网站文档目录:
1 2 3 |
cd ~ sudo mv ~/wallabag/ /usr/share/nginx/ sudo chown http:http /usr/share/nginx/wallabag -R |
添加Nginx虚拟主机配置:
1 |
sudo vim /etc/nginx/conf.d/wallabag.conf |
写入内容:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
server { server_name your_domain.com; root /usr/share/nginx/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/php7.0-fpm.sock; fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; fastcgi_param DOCUMENT_ROOT $realpath_root; internal; } error_log /var/log/nginx/wallabag_error.log; access_log /var/log/nginx/wallabag_access.log; } |
注意替换域名。
重启Nginx:
1 |
sudo systemctl restart nginx |
使用浏览器访问your_domain.com完成安装。
安装基本的SMTP服务,用来发邮件:
1 2 3 |
sudo pacman -S postfix sudo systemctl start postfix sudo systemctl enable postfix |