Sub-Store部署教程
本地运行订阅转换器 sub-store¶
服务器版部署,无需看懂代码,无需配置任何开发环境 !!!
服务器版部署,无需看懂代码,无需配置任何开发环境 !!!
服务器版部署,无需看懂代码,无需配置任何开发环境 !!!
下载release编译好的文件https://github.com/chenyk1219/Sub-Store-Local, 是这个dist.zip压缩包,不是source源码包
这次把前后端都放一起了,不用到处跑了,dist是前端,后端就下对应系统的就行了
1. 运行后端(均在服务器上执行)¶
- 新建目录
mkdir /data/sub-store
- 下载最新的release包
cd /data/sub-store
wget https://github.com/chenyk1219/Sub-Store-Local/releases/latest/download/sub-store-linux.tar.gz
- 解压
tar -zxvf sub-store-linux.tar.gz
- 配置服务自启动
cat > /etc/systemd/system/sub-store.service << EOF
[Unit]
Description=A API For Sub-Store
After=network.target
[Service]
Type=simple
ExecStart=/data/sub-store/sub-store-linux/sub-store.bundle
WorkingDirectory=/data/sub-store/sub-store-linux/
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
- 启动服务
systemctl daemon-reload
systemctl enable sub-store
systemctl restart sub-store
- 查看服务状态
systemctl status sub-store
2. 运行前端(需要使用nginx代理)¶
- 下载最新的release包
cd /data/sub-store
wget https://github.com/chenyk1219/Sub-Store-Local/releases/latest/download/dist.tar.gz
tar -zxvf dist.tar.gz
- 安装nginx
yum install nginx -y
或者
sudo apt install nginx -y
- 配置nginx
cat > /etc/nginx/conf.d/sub-store.conf << \EOF
server {
listen 80;
server_name sub-store.xxxxx.com;
# 可选配置,使用https
# if ($scheme = http) {
# return 301 https://$server_name$request_uri;
# }
# listen 443 ssl;
# ssl_certificate /path/to/cert/xxxx.com.pem;
# ssl_certificate_key /path/to/cert/xxxx.com.key;
# ssl_session_cache shared:SSL:10m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# gzip on;
# gzip_buffers 4 16k;
# gzip_http_version 1.0;
# gzip_comp_level 5;
# gzip_vary on;
# charset utf-8,gbk;
location / {
root /data/sub-store/dist/;
index index.html;
}
}
EOF
cat > /etc/nginx/conf.d/sub-store-api.conf << \EOF
server {
listen 80;
server_name sub-store-api.xxxxx.com;
access_log off;
# 可选配置,使用https
# if ($scheme = http) {
# return 301 https://$server_name$request_uri;
# }
# listen 443 ssl;
# ssl_certificate /path/to/cert/xxxx.com.pem;
# ssl_certificate_key /path/to/cert/xxxx.com.key;
# ssl_session_cache shared:SSL:10m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# gzip on;
# gzip_buffers 4 16k;
# gzip_http_version 1.0;
# gzip_comp_level 5;
# gzip_vary on;
# charset utf-8,gbk;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
proxy_redirect off;
proxy_set_header Host $host:$proxy_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
EOF
- 修改配置文件,替换自己的域名
sed -i 's#sub-store.xxxxx.com#sub-store.test.com#g' /etc/nginx/conf.d/sub-store.conf
sed -i 's#sub-store-api.xxxxx.com#sub-store-api.test.com#g' /etc/nginx/conf.d/sub-store-api.conf
sed -i 's#http://0.0.0.0:3000#http://sub-store-api.test.com#g' /data/sub-store/dist/main.js
- 重启nginx
systemctl restart nginx
页面直接访问域名即可