为Nginx优雅配置https证书, 完善私有化部署RSSHub


title: 为Nginx优雅配置https证书, 完善私有化部署RSSHub

RSSHub是个很有趣的开源项目,把各种网站的内容转换为RSS, 官方提供了rsshub.app域名对外提供服务,但官方服务用的人太多了,经常会取不到数据,zhaoolee前几天私有化部署了RSSHub到树莓派,并内网穿透到了公网《树莓派4B家庭服务器搭建指南》第六期:树莓派抓取微博博主RSS并提供公网访问,将RSSHub私有化部署到树莓派 https://www.v2fy.com/p/2021-10-20-rsshub-pi-1634690989000/

前一期完成了运行在树莓派1200端口,并穿透到了公网服务器,今天配置了一下https,将http://rsshub.v2fy.com:1200 转换为 https://rsshub.v2fy.com 李子柒的微博也就变成了 https://rsshub.v2fy.com/weibo/user/2970452952

Nginx配置

配置文件位置为/etc/nginx/conf.d/rsshub.v2fy.com.conf

/etc/nginx/conf.d/rsshub.v2fy.com.conf中的内容为

upstream rsshub_v2fy_com { server 127.0.0.1:1200; }

server {
    server_name      rsshub.v2fy.com;
    listen           80;
    rewrite ^(.*)$ https://$host$1 permanent;

}



server {
    listen       443 ssl http2;
    listen       [::]:443 ssl http2;
    server_name  rsshub.v2fy.com;

    location / {
        proxy_pass http://rsshub_v2fy_com;
        proxy_set_header Host $host:443;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    ssl_certificate "/etc/nginx/ssl/rsshub.v2fy.com/fullchain.cer";
    ssl_certificate_key "/etc/nginx/ssl/rsshub.v2fy.com/rsshub.v2fy.com.key";
    ssl_session_cache shared:SSL:1m;
    ssl_session_timeout  10m;
    ssl_ciphers HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers on;

    # Load configuration files for the default server block.

    error_page 404 /404.html;
        location = /40x.html {
    }

    error_page 500 502 503 504 /50x.html;
        location = /50x.html {
    }
}

https证书自动续期教程请前往 《零依赖!使用acme.sh设置nginx多个https证书自动更新,无限续期https证书》 https://www.v2fy.com/p/2021-06-27-nginx-https-1624774964000/


最后提供几个好玩的RSS订阅地址

异次元软件世界

极具人气和特色的软件网站!专注于推荐优秀软件、APP应用和互联网资源,每篇图文评测都极其用心,并提供大量软件资源下载。

树莓派对公网提供的RSS订阅地址

https://rsshub.v2fy.com/iplay/home


一兜糖

家的主理人社区

树莓派对公网提供的RSS订阅地址

https://rsshub.v2fy.com/yidoutang/index


香水时代

最新香水评论-发现香水圈的新鲜事

树莓派对公网提供的RSS订阅地址

https://rsshub.v2fy.com/nosetime/home


游戏葡萄

深度解读游戏

树莓派对公网提供的RSS订阅地址

https://rsshub.v2fy.com/gamegrape/13


起点中文网

限时免费榜

树莓派对公网提供的RSS订阅地址

https://rsshub.v2fy.com/qidian/free


恩山无线论坛

无线路由器爱好者的乐园

树莓派对公网提供的RSS订阅地址

https://rsshub.v2fy.com/right/forum/31

如果你对树莓派或RSS感兴趣,可以来交流

zhaoolee建了个RSS树莓派技术交流群,目前已经200多人,可以通过公众号0加1最右侧菜单选项,找到zhaoolee, 备注RSS树莓派交流群加好友,zhaoolee会拉你入群。

本文永久更新地址(欢迎来读留言,写评论):

https://www.v2fy.com/p/2021-11-24-nginx-rsshub-1637763933000