-
Notifications
You must be signed in to change notification settings - Fork 415
/
2_nginx.conf
55 lines (47 loc) · 2.51 KB
/
2_nginx.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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#在‘http{}’里面添加(或修改)如下两个‘server’配置:
http {
#.........<省略>........
server {
listen 80; #IPv4,http默认监听端口。
listen [::]:80; #IPv6,http默认监听端口。无IPv6,此项可以删除。
return 301 https://$host$request_uri; #http自动跳转https,让网站看起来更真实。
}
server {
listen 443 ssl http2; #IPv4,https默认监听端口,且启用支持http/2。
listen [::]:443 ssl http2; #IPv6,https默认监听端口,且启用支持http/2。无IPv6,此项可以删除。
server_name xx.yy; #更改为自己的域名
ssl_certificate /home/tls/xx.yy/xx.yy.crt; #换成自己的证书,绝对路径。
ssl_certificate_key /home/tls/xx.yy/xx.yy.key; #换成自己的密钥,绝对路径。
ssl_protocols TLSv1.2 TLSv1.3; #TLSv1.3可能需要源码编译才支持,见此部分README.md说明。
ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-CHACHA20-POLY1305;
ssl_prefer_server_ciphers on;
location = /HALdGZ9k { #与vless+ws应用中path对应
proxy_redirect off;
proxy_pass unix:/dev/shm/vws.sock; #转发给本机vless+ws监听进程
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location = /SS1v2ray { #与Xray-plugin或v2ray-plugin模块中path对应
proxy_redirect off;
proxy_pass https://127.0.0.1:2002; #转发给本机Xray-plugin或v2ray-plugin监听端口
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /cdngrpc { #与vless+grpc应用中serviceName对应
grpc_pass grpc:https://unix:/dev/shm/vgrpc.sock; #转发给本机vless+grpc监听进程
}
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always; #启用HSTS
location / {
root /var/www/html/; #更改为自己存放的web文件路径
index index.html index.htm;
}
}
}