家庭的nginx配置备份

通过nginx对家用的服务器做集中路由,不用记住ip以及端口信息,这里做一下备份

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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
server {
listen 80;
server_name inner-blog.royjo.ltd;

location / {
root /home/johnzb/code/ledkk.github.io/public/ ;
index index.html;

}

}


server {
listen 80;
server_name inner-nas.royjo.ltd;

location / {
proxy_pass http://192.168.0.11:8080;
proxy_set_header Host $Host;
proxy_set_header x-forwarded-for $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
add_header Cache-Control no-store;
add_header Pragma no-cache;
proxy_http_version 1.1; # 这两个最好也设置
proxy_set_header Connection "";

}


}

client_max_body_size 0;


server {
# https://distribution.github.io/distribution/recipes/nginx/
listen 443 ssl;
server_name inner-docker.royjo.ltd;
ssl_certificate /etc/nginx/conf.d/inner-docker.royjo.ltd.crt;
ssl_certificate_key /etc/nginx/conf.d/inner-docker.royjo.ltd.key;
ssl_protocols TLSv1.1 TLSv1.2;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
ssl_prefer_server_ciphers on;
# disable any limits to avoid HTTP 413 for large image uploads
client_max_body_size 0;

location / {

proxy_pass http://127.0.0.1:5000;
proxy_set_header Authorization $http_authorization;
proxy_pass_header Authorization;
proxy_set_header Host $http_host; # required for docker client's sake
proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 900;

}


}


server {
listen 80;
server_name inner-bt.royjo.ltd;
location / {
proxy_pass http://192.168.0.11:9091;
proxy_set_header Host $Host;
proxy_set_header x-forwarded-for $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
add_header Cache-Control no-store;
add_header Pragma no-cache;
proxy_http_version 1.1;
proxy_set_header Connection "";

}
}

# https://grafana.com/docs/grafana/latest/setup-grafana/set-up-grafana-live/
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}




server {

listen 80;
server_name inner.royjo.ltd;


location / {
proxy_pass http://127.0.0.1:8099;
proxy_set_header Host $Host;
proxy_set_header x-forwarded-for $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
add_header Cache-Control no-store;
add_header Pragma no-cache;
proxy_http_version 1.1; # 这两个最好也设置
proxy_set_header Connection "";
}

location /grafana/ {
proxy_pass http://127.0.0.1:9900/;
proxy_set_header Host $Host;
proxy_set_header x-forwarded-for $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
add_header Cache-Control no-store;
add_header Pragma no-cache;
proxy_http_version 1.1; # 这两个最好也设置
proxy_set_header Connection "";
}


location /grafana/api/live/ws {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:9900/api/live/ws;

}

location /prometheus/ {
proxy_pass http://127.0.0.1:9090/;
proxy_set_header Host $Host;
proxy_set_header x-forwarded-for $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
add_header Cache-Control no-store;
add_header Pragma no-cache;
proxy_http_version 1.1; # 这两个最好也设置
proxy_set_header Connection "";
}


location /nas/ {

proxy_pass http://192.168.0.11:8080/;
proxy_set_header Host $Host;
proxy_set_header x-forwarded-for $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
add_header Cache-Control no-store;
add_header Pragma no-cache;
proxy_http_version 1.1; # 这两个最好也设置
proxy_set_header Connection "";

}

location /fs {

root /tmp/share/;
autoindex on;
autoindex_exact_size on;
autoindex_localtime on;
}
}