Reduce quality for faster access speed

This commit is contained in:
Sahik committed 2026-10-24 23:36:17 +08:00
1 parent b153d786cf
commit b204dd70ed
1 file changed
+67
+67
View File
@@ -0,0 +1,67 @@
# SimpleRickroll
掛在網域根目錄(`https://sthkm3.org`)的誘餌頁面。任何路徑都會回一個標題為 "About" 的頁面並播放 Rick Astley,讓亂逛的人和掃描 `/wp-admin`、`/.env` 的機器人吃到 rickroll。
純靜態網站:沒有後端、沒有資料、不掛載任何路徑。
## 檔案
| 檔案 | 說明 |
| --- | --- |
| `Dockerfile` | 以 `nginxinc/nginx-unprivileged:stable-alpine` 為基底,非 root(uid 101)執行 |
| `nginx.conf` | 監聽 `1000`;所有路徑回 `index.html`;只允許 GET/HEAD,其他回 405;隱藏版本號 |
| `index.htm` | 頁面。先嘗試有聲播放,被瀏覽器擋下就靜音播放,使用者第一次點擊/按鍵時開聲音 |
| `rickroll.mp4` | 960×720 60fps H.264 + AAC,約 28MB,faststart |
## 本地測試
```sh
docker build -t simplerickroll:local .
docker run -d --name simplerickroll \
--read-only --tmpfs /tmp \
--cap-drop ALL --security-opt no-new-privileges \
--memory 64m --pids-limit 64 \
-p 127.0.0.1:1000:1000 simplerickroll:local
```
打開 <http://127.0.0.1:1000/>。
## 部署(TrueNAS SCALE Apps)
容器只接在 `cloudflared_proxy` 網路上,不對外開 port,只有 cloudflared 能連到。Cloudflare Tunnel 的 service 設為 `http://rickroll:1000`。
```yaml
services:
rickroll:
build: https://<gitea>/sthkm3/SimpleRickroll.git#<release-tag>
container_name: rickroll
restart: unless-stopped
read_only: true
tmpfs: [/tmp]
cap_drop: [ALL]
security_opt: [no-new-privileges:true]
mem_limit: 64m
pids_limit: 64
networks: [cloudflared_proxy]
networks:
cloudflared_proxy:
external: true
```
偶爾重新 build 以取得 nginx 安全更新。
## 更換影片
影片直接進 git,**不要用 Git LFS**(從 git URL build 時不會抓 LFS 檔案)。保持 H.264 + AAC 的 mp4,Safari / iOS 才能播。
```sh
ffmpeg -i source.mp4 -vf "scale=-2:720:flags=lanczos" -r 60 \
-c:v libx264 -preset slow -crf 28 -maxrate 900k -bufsize 1800k \
-profile:v high -level 4.2 -pix_fmt yuv420p -g 120 \
-c:a aac -b:a 128k -ac 2 -movflags +faststart rickroll.mp4
```
## 注意
這個頁面只保護根網域,**擋不住對子網域的直接攻擊**。子網域可以從憑證透明度紀錄或 DNS 爆破找到,公開服務(n8n、crafty 等)仍需各自更新與防護,例如用 Cloudflare Access 鎖住管理介面、只放行必要路徑。