• 我们在哪一颗星上见过 ,以至如此相互思念 ;我们在哪一颗星上相互思念过,以至如此相互深爱
  • 我们在哪一颗星上分别 ,以至如此相互辉映 ;我们在哪一颗星上入睡 ,以至如此唤醒黎明
  • 认识世界 克服困难 洞悉所有 贴近生活 寻找珍爱 感受彼此

selfoss 安装指南

软件操作 云涯 3年前 (2022-02-16) 1757次浏览

安装

1. 将压缩包下载到/var/www/目录中并解压

wget https://github.com/SSilence/selfoss/releases/download/2.15/selfoss-2.15.zip

2. 给相应的文件夹权限

chmod 775 data/cache data/favicons data/logs data/thumbnails data/sqlite public/ controllers/

3. 创建并修改应用配置文件

https://selfoss.aditu.de/docs/administration/options/

cp defaults.in config.in 按照官网修改相应信息

4. 为应用创建nginx配置

cd /etc/nginx/conf.d/

sudo editor selfoss.conf

其中selfoss内容如下:

server {

  listen 0.0.0.0:80;
  listen 443 ssl;
  server_name localhost;
  root /var/www/selfoss/;
  access_log /var/log/nginx/rss.access.log;
  error_log /var/log/nginx/rss.error.log;


  location ~* \ (gif|jpg|png) {
    expires 30d;
  }

  location ~ ^/favicons/.*$ {
    try_files $uri /data/$uri;
  }

  location ~ ^/thumbnails/.*$ {
    try_files $uri /data/$uri;
  }

  location ~* ^/(data\/logs|data\/sqlite|config\.ini|\.ht) {
    deny all;
  }

  location / {
    index index.php index.html index.htm;
    try_files $uri /public/$uri /index.php$is_args$args;
  }

  location ~ \.php$ {
    fastcgi_pass unix:/run/php/php7.2-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PHP_VALUE "session.gc_maxlifetime=86400";
    include fastcgi_params;
  }
}

5. 用户权限

sudo chown -R www-data:www-data /var/www/selfoss/

6. 重启nginx

sudo systemctl restart nainx.service

sudo systemctl enable nginx.service

7. 定时更新源

sudo crontab -e

添加:*/30 * * * * /usr/bin/curl -Ls 'http://rss.yourdomain.com/update' >/dev/null

sudo systemctl start cron

8. 登录

访问https://your_selfoss_url.com/password,获取哈希后的密码,填入到ini中,登录即可

设置代理

在/selfoss/spouts/rss/feed.php 中为rss feed模块设置代理

参考:https://github.com/fossar/selfoss/issues/871

在154行左右

@$this->feed->set_feed_url(htmlspecialchars_decode($params[‘url’]));

@$this->feed->set_autodiscovery_level( SIMPLEPIE_LOCATOR_AUTODISCOVERY | SIMPLEPIE_LOCATOR_LOCAL_EXTENSION | SIMPLEPIE_LOCATOR_LOCAL_BODY);

$this->feed->set_useragent(\helpers\WebClient::getUserAgent(array(‘SimplePie/’.SIMPLEPIE_VERSION)));

下面添加

$this->feed->set_curl_options(array(CURLOPT_PROXY => ‘localhost:9050‘, CURLOPT_PROXYTYPE => ‘CURLPROXY_SOCKS5’));

 

问题解决

502错误

查看日志发现是[error] 38134#38134: *25 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 127.0.0.1, server: localhost, request: “GET /update HTTP/1.1”, upstream: “fastcgi://127.0.0.1:9000”, host: “127.0.0.1”

重启 php7.2-fpm.service:sudo systemctl restart php7.2-fpm.service

为了保证php7.2-fpm.service崩溃自动重启:

1. 建立  sudo mkdir /etc/systemd/system/php7.2-fpm.service.d

2. 在php7.2-fpm.service.d目录里面,建立override.conf,内容是

[Service]
Restart=always
RestartSec=10

3. sudo systemctl daemon-reload

4. sudo systemctl restart php7.2-fpm.service

遗留问题

nginx跨域不生效

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


云涯历险记 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:selfoss 安装指南
喜欢 (0)