nginx 反向代理
certbot通过Cloudflare-api验证申请ssl证书
xunlei 下载器 内网地址:
http://localhost:2345
xunlei 下载器 公网地址:
https://xunlei.example.com:666
创建 xunlei 反向代理配置文件
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
45
|
mkdir -pm 755 /etc/nginx/conf.d && touch /etc/nginx/conf.d/xunlei.conf && cat <<'EOF' | sed '1!{/^[[:space:]]*#/d;/^[[:space:]]*$/d}' > /etc/nginx/conf.d/xunlei.conf
## nginx 反向代理: xunlei 下载器
server {
## 监听666端口,并启用SSL
listen 666 ssl;
listen [::]:666 ssl;
## 替换为你的域名
server_name xunlei.example.com;
## 指定 SSL 证书文件和私钥文件的路径
ssl_certificate /etc/nginx/keyfile/cert.pem;
ssl_certificate_key /etc/nginx/keyfile/key.pem;
## 设置支持的SSL协议版本
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
# 启用服务器端加密套件优先
ssl_prefer_server_ciphers on;
## 设置加密套件,优先用高强度加密算法,并排除匿名加密套件和MD5散列算法
ssl_ciphers HIGH:!aNULL:!MD5;
location / {
## 指定反向代理的服务地址
proxy_pass http://localhost:2345;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Range $http_range;
proxy_set_header If-Range $http_if_range;
proxy_redirect off;
## 开启缓存
proxy_buffering on;
## 使用 HTTP/1.1 协议通信
proxy_http_version 1.1;
}
## 错误处理
charset utf-8; ## 添加这行来指定编码
error_page 404 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/html;
}
}
EOF
sudo systemctl restart nginx
|