使用 caddy 搭建一个维基百科的镜像并添加广告赚钱 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
chenjia404
V2EX    分享创造

使用 caddy 搭建一个维基百科的镜像并添加广告赚钱

  •  
  •  
    chenjia404 2024-09-01 11:12:01 +08:00 2836 次点击
    这是一个创建于 405 天前的主题,其中的信息可能已经有所发展或是发生改变。

    安装 replace-response 模块

    caddy add-package github.com/caddyserver/replace-response 

    Caddyfile

    主站

    http://zhwk.example.com { reverse_proxy * https://zh.wikipedia.org { header_up Host {upstream_hostport} header_up X-Real-IP {http.request.remote.host} header_up X-Forwarded-For {http.request.remote.host} header_up X-Forwarded-Port {http.request.port} header_up X-Forwarded-Proto {http.request.scheme} header_up Accept-Encoding identity header_down location ( https://zh.wikipedia.org/)(.*) https://zhwk.example.com/$2 header_down location ( https://zh.m.wikipedia.org/)(.*) http://mzhwk.example.com/$2 } replace { "upload.wikimedia.org" "upzhwk.example.com" "zh.wikipedia.org" "zhwk.example.com" "zh.m.wikipedia.org" "mzhwk.example.com" "/w/index.php?title=Special:%E7%94%A8%E6%88%B7%E7%99%BB%E5%BD%95" "" "w/index.php?title=Special:%E5%88%9B%E5%BB%BA%E8%B4%A6%E6%88%B7" "" "action=edit" "" "</head>" "<style> .vector-menu-content-list,#ca-edit,#p-vector-user-menu-overflow,.mw-editsection{display: none;}</style></head>" } } 

    移动站

    http://mzhwk.example.com { reverse_proxy * https://zh.m.wikipedia.org { header_up Host {upstream_hostport} header_up X-Real-IP {http.request.remote.host} header_up X-Forwarded-For {http.request.remote.host} header_up X-Forwarded-Port {http.request.port} header_up X-Forwarded-Proto {http.request.scheme} header_up Accept-Encoding identity header_down location ( https://zh.wikipedia.org/)(.*) https://zhwk.example.com/$2 header_down location ( https://zh.m.wikipedia.org/)(.*) http://mzhwk.example.com/$2 } replace { "upload.wikimedia.org" "upzhwk.example.com" "zh.wikipedia.org" "zhwk.example.com" "zh.m.wikipedia.org" "mzhwk.example.com" "/w/index.php?title=Special:%E7%94%A8%E6%88%B7%E7%99%BB%E5%BD%95" "" "w/index.php?title=Special:%E5%88%9B%E5%BB%BA%E8%B4%A6%E6%88%B7" "" "action=edit" "" "</head>" "<style> #page-actions-edit,.mw-editsection,#p-personal{display: none;}</style></head>" } } 

    静态资源

    http://upzhwk.example.com { reverse_proxy * https://upload.wikimedia.org { header_up Host {upstream_hostport} header_up X-Real-IP {http.request.remote.host} header_up X-Forwarded-For {http.request.remote.host} header_up X-Forwarded-Port {http.request.port} header_up X-Forwarded-Proto {http.request.scheme} header_up Accept-Encoding identity } } 

    屏蔽了登录、注册、编辑功能,防止被恶意使用。

    请将 example.com 替换成自己的域名,另外因为 cloudflare 不支持 多级子域名,所以移动站的一级子域名使用的 mzhwk 。

    添加广告

    如果需要添加广告,请加入下面内容

    "</body>" "广告代码</body>" 

    注意事项

    • 运行的服务器必须可以访问维基百科。
    • 使用一个新的独立域名,避免造成主域名不可用。
    • 可以在 cloudflare 上开启禁止自动机器人。
    • 可以设置一个用户名和密码,限制他人访问。
    • 另外你也可以加入谷歌广告,赚回来一些服务器成本。
    • 推荐使用 cloudflare ,避免服务器 ip 被墙。

    推荐廉价域名后缀

    • win 4.16 美元,续费 5.16
    • uk 4.94 美元,续费 4.94
    • us 6.50 美元,续费 6.50
    • cc 8 美元,续费 8

    还有一些首年 1 美元的域名后缀,不过续费有一些贵,如果做一次性域名就很划算。

    我搭建的一个样例: https://zhwk.kkwiki.win/ 不过没有加广告。

    你们可以按教程搭建,然后加谷歌广告赚外汇。

    原文: https://blog.chenjia.info/posts/2024/08/%E4%BD%BF%E7%94%A8caddy%E6%90%AD%E5%BB%BA%E4%B8%80%E4%B8%AA%E7%BB%B4%E5%9F%BA%E7%99%BE%E7%A7%91%E7%9A%84%E9%95%9C%E5%83%8F%E5%B9%B6%E6%B7%BB%E5%8A%A0%E5%B9%BF%E5%91%8A/

    cat9life
        1
    cat9life  
       2024-09-02 08:44:43 +08:00
    是面向墙内的用户吗?
    tbg
        2
    tbg  
       2024-09-02 09:10:13 +08:00
    真的可以赚吗
    nmap
        3
    nmp  
       2024-09-02 10:48:24 +08:00
    难道不是秒被墙?
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     3901 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 25ms UTC 05:13 PVG 13:13 LAX 22:13 JFK 01:13
    Do have faith in what you're doing.
    ubao snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86