如何安装freshrss(在SQLite、debian12、docker、nginx环境下)

110 2247

docker和docker compose安装

apt install curl vim wget gnupg dpkg apt-transport-https lsb-release ca-certificates

curl -sSL https://download.docker.com/linux/debian/gpg | gpg --dearmor > /usr/share/keyrings/docker-ce.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-ce.gpg] https://download.docker.com/linux/debian $(lsb_release -sc) stable" > /etc/apt/sources.list.d/docker.list


curl -sS https://download.docker.com/linux/debian/gpg | gpg --dearmor > /usr/share/keyrings/docker-ce.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-ce.gpg] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian $(lsb_release -sc) stable" > /etc/apt/sources.list.d/docker.list

apt update
apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin

docker version
docker compose version

cat > /etc/docker/daemon.json << EOF
{
    "log-driver": "json-file",
    "log-opts": {
        "max-size": "20m",
        "max-file": "3"
    },
    "ipv6": true,
    "fixed-cidr-v6": "fd00:dead:beef:c0::/80",
    "experimental":true,
    "ip6tables":true
}
EOF

systemctl restart docker

参考:Debian 12 / Ubuntu 24.04 安装 Docker 以及 Docker Compose 教程 - 烧饼博客

安装freshrss

创建docker-compose.yml文件

version: "2.4"
services:
  freshrss:
    image: freshrss/freshrss:1.24.3
    # Optional build section if you want to build the image locally:
    # build:
    #   # Pick #latest (stable release) or #edge (rolling release) or a specific release like #1.21.0
    #   context: https://github.com/FreshRSS/FreshRSS.git#latest
    #   dockerfile: Docker/Dockerfile-Alpine
    container_name: freshrss
    restart: unless-stopped
    logging:
      options:
        max-size: 10m
    volumes:
      # Recommended volume for FreshRSS persistent data such as configuration and SQLite databases
      - /opt/freshrss/data:/var/www/FreshRSS/data
      # Optional volume for storing third-party extensions
      - /opt/freshrss/extensions:/var/www/FreshRSS/extensions
      # Optional file providing custom global settings (used before a FreshRSS install)
      # - ./config.custom.php:/var/www/FreshRSS/data/config.custom.php
      # Optional file providing custom user settings (used before a new user is created)
      # - ./config-user.custom.php:/var/www/FreshRSS/data/config-user.custom.php
    ports:
      # If you want to open a port 8080 on the local machine:
      - "9090:80"
    environment:
      # A timezone http://php.net/timezones (default is UTC)
      TZ: Asia/Shanghai
      # Cron job to refresh feeds at specified minutes
      CRON_MIN: '2,32'

上传到服务器指定文件夹,运行docker compose up -d

默认就是使用SQLite作为数据库

更多参考配置:FreshRSS/Docker/README.md at edge · FreshRSS/FreshRSS

nginx配置

upstream freshrss {
	server 127.0.0.1:9090;
	keepalive 64;
}



server {
	server_name a.com;
	listen 443 ssl http2;

	# Other SSL stuff goes here


	ssl_certificate /ssl/1fullchain.pem;
	ssl_certificate_key /ssl/1key.pem;
	ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;

	
	access_log /usr/local/openresty/nginx/logs/freshrss.access.log main;
	error_log /usr/local/openresty/nginx/logs/freshrss.error.log;


	location / {
		# The final `/` is important.
		proxy_pass http://freshrss/;
		add_header X-Frame-Options SAMEORIGIN;
		add_header X-XSS-Protection "1; mode=block";
		proxy_redirect off;
		proxy_buffering off;
		proxy_set_header Host $host;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header X-Forwarded-Proto $scheme;
		proxy_set_header X-Forwarded-Port $server_port;
		proxy_read_timeout 90;

		# Forward the Authorization header for the Google Reader API.
		proxy_set_header Authorization $http_authorization;
		proxy_pass_header Authorization;
	}
}


Prev Post 如何在搜索结果中屏蔽指定网站
Next Post linux创建swap交换空间并配置交换频率