本文最后更新于 117 天前,其中的信息可能已经过时,如有错误请留言。
安装配置docker
编写yaml文件
tee docker-compose.yml <<-'EOF'
version: '3'
services:
twikoo:
image: imaegoo/twikoo
container_name: twikoo
restart: unless-stopped
ports:
- 8087:8080 ## 将宿主机8087端口映射到容器8080
environment:
TWIKOO_THROTTLE: 1000
volumes:
- ./data:/app/data ## 将容器的/app/data/目录持久化到宿主机当前目录的data下
EOF
```
启动twikoo容器
-d 后台运行
docker compose up -d
docker ps ## 查看容器状态
放行ecs的8087端口
为twikoo配置https
准备一个子域名并准备对应的ssl证书
配置nginx代理
cat kshar.cn.conf
server {
listen 80;
listen 443 ssl;
server_name cmm.clls.online;
#强制SSL
if ($server_port !~ 443){
rewrite ^(/.*)$ https://$host$1 permanent;
}
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
##ssl路径
ssl_certificate /cert/twikoo/xxx.pem;
ssl_certificate_key /cert/twikoo/xxx.key;
location / {
proxy_pass http://127.0.0.1+端口;
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 REMOTE-HOST $remote_addr;
}
}