Docker+Nginx的方式安装sub-store

迁移之前的sub-tore,顺带存档一份安装教程,后面再迁移就懒得找教程了

安装sub-store

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#Install Docker
curl -fsSL get.docker.com -o get-docker.sh
sh get-docker.sh

mkdir -p /home/substore
cd /home/substore

nano docker-compose.yml

services:
sub-store:
image: xream/sub-store:http-meta
container_name: sub-store
restart: always
network_mode: host
environment:
SUB_STORE_BACKEND_API_HOST: 127.0.0.1
SUB_STORE_BACKEND_API_PORT: 3001
SUB_STORE_BACKEND_MERGE: true
SUB_STORE_FRONTEND_BACKEND_PATH: /cD7wiTGitLyoBdEguAnFWmqCpHKwhLQh4opXfFhFCEpmY9K7YnPgFu9e2iiUoty2
# HTTP-META 的, 一般不用改
PORT: 9876
HOST: 127.0.0.1
volumes:
- ./data:/opt/app/data

docker compose up -d

各种参数的详细说明

配置Nginx

提供一个简单的Nginx管理脚本

wget https://raw.githubusercontent.com/cipherorcom/ssh_tool/refs/heads/main/nginx.sh && chmod +x nginx.sh && ./nginx.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Redirect HTTP to HTTPS
server {
listen 80;
listen [::]:80;
server_name your-sub-store-domain;
return 301 https://$host$request_uri;
}

# HTTPS Server
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name your-sub-store-domain;

ssl_certificate your-ssl-path;
ssl_certificate_key your-ssl-path;

# SSL Best Practices
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers off;
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
ssl_ecdh_curve secp384r1;
ssl_session_cache shared:SSL:10m;
ssl_session_tickets off;
ssl_stapling on;
ssl_stapling_verify on;
resolver 8.8.8.8 8.8.4.4 valid=300s;
resolver_timeout 5s;

access_log /var/log/nginx/your-sub-store-domain.access.log;
error_log /var/log/nginx/your-sub-store-domain.error.log;

location / {
proxy_pass http://127.0.0.1:3001;
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_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}

访问

https://your-sub-store-domain?api=https://your-sub-store-domain/cD7wiTGitLyoBdEguAnFWmqCpHKwhLQh4opXfFhFCEpmY9K7YnPgFu9e2iiUoty2

需要修改的内容 说明 替换位置
your-sub-store-domain 你的访问域名 Nginx配置文件 & 访问的URL路径
your-ssl-path 你的SSL证书路径 Nginx配置文件
cD7wiTGit…..Uoty2 你的API访问路径 访问的URL路径

备份 & 恢复

我的 -> 手动管理 -> 备份 or 恢复

backup.png