-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.conf
More file actions
56 lines (47 loc) · 1.62 KB
/
Copy pathexample.conf
File metadata and controls
56 lines (47 loc) · 1.62 KB
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
56
# 负载均衡
upstream example-server {
server 172.16.211.155:16600;
server 172.16.211.156:16600;
server 172.16.211.153:16600;
}
# http 自动转 https
server {
listen 80;
server_name example.junmoyu.com;
# 307 可以转发 POST 请求,301 不可以
return 307 https://example.junmoyu.com$request_uri;
# rewrite ^(.*)$ https://$host$1 permanent;
}
# HTTPS 反向代理
server {
listen 443 ssl;
server_name example.junmoyu.com;
ssl_certificate /home/cert/5257519__junmoyu.com.pem;
ssl_certificate_key /home/cert/5257519__junmoyu.com.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
# 需要自定义专属的请求日志和错误日志
access_log /var/log/nginx/example/access.log;
error_log /var/log/nginx/example/error.log;
location /example/ {
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 Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://example-server/example/;
}
}
# 配置内网服务器访问
server {
listen 80;
server_name example-inner.junmoyu.com;
# 需要自定义专属的请求日志和错误日志
access_log /var/log/nginx/example/access.log;
error_log /var/log/nginx/example/error.log;
location /example/ {
proxy_pass http://example-server/example/;
}
}