sub转换

sub自建

1
wget https://github.com/tindy2013/subconverter/releases/latest/download/subconverter_linux64.tar.gz 
1
tar -xvf subconverter_linux64.tar.gz

pref.ini

//managed_config_prefix=你的网站

//listen=127.0.0.1

managed_config_prefix=http://127.0.0.1:25500

listen=0.0.0.0

1
curl https://get.acme.sh | sh 
1
cd /root/.acme.sh/
1
apt install socat
1
./acme.sh  --issue -d 你的网站  --standalone
1
2
3
./acme.sh  --installcert  -d  你的网站   \
--key-file /etc/ssl/你的网站.key \
--fullchain-file /etc/ssl/你的网站.cer
1
2
3
4
5
6
7
apt install nginx -y
cd /etc/nginx
mkdir host
vim nginx.conf
http 模块中加入include /etc/nginx/host/*.conf;
cd /host
vim 你的网站.conf

此为多网站单网站配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
server {
listen 80;
server_name 你的网站;
rewrite ^(.*)$ https://$host$1 permanent;
}

server {
listen 443 ssl;
server_name 你的网站;
ssl_certificate /etc/ssl/你的网站.cer;
ssl_certificate_key /etc/ssl/你的网站.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
location / {
proxy_pass http://127.0.0.1:6688;
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 REMOTE-HOST $remote_addr;
}
}

下为为网站单独配置文件:

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
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
worker_connections 768;
# multi_accept on;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
server {
listen 80;
server_name 你的网站;
rewrite ^(.*)$ https://$host$1 permanent;
}
server {
listen 443 ssl;
server_name 你的网站;
ssl_certificate /etc/ssl/fullchain.cer;
ssl_certificate_key /etc/ssl/你的网站.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
# error_page 497 https://$host$request_uri;
location / {
proxy_pass http://127.0.0.1:25500; #对应 pref.ini 里的配置
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 REMOTE-HOST $remote_addr;
}
}
include /etc/nginx/mime.types;
default_type application/octet-stream;
}
1
2
nginx -c 你的网站.conf
如果为多网站模式,这nginx -c nginx.conf
1
2
3
4
5
wget -qO- https://getpm2.com/install.sh | bash
cd /root/subconverter
pm2 start subconverter
pm2 startup
pm2 save

搭建成功,输入域名则显示File Not Found

无法启动可安装

apt install net-tools

netstat -ntpl