跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[分享创造] 使用 caddy 搭建一个维基百科的镜像并添加广告赚钱

发表于

安装 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/

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.