This repository has been archived by the owner on Apr 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.conf
252 lines (203 loc) · 8.12 KB
/
default.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
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# ===================================
# IMPORTANT Only expose port 80
# ===================================
# -----------------------------------
# Kidoju server upstream
# -----------------------------------
upstream kidoju-server {
least_conn; # ip_hash;
server kidoju-server-1:3001;
server kidoju-server-2:3001;
keepalive 64;
}
# -----------------------------------
# Kidoju webapp upstream
# -----------------------------------
upstream kidoju-webapp {
least_conn; # ip_hash;
server kidoju-webapp-1:3000;
server kidoju-webapp-2:3000;
keepalive 64;
}
# -----------------------------------
# Kidoju blog upstream
# -----------------------------------
upstream kidoju-blog {
server kidoju-blog-1:3000;
keepalive 32;
}
# -----------------------------------
# Memba blog upstream
# -----------------------------------
upstream memba-blog {
server memba-blog-1:3000;
keepalive 32;
}
# -----------------------------------
# Memba server
# -----------------------------------
server {
server_name memba.com www.memba.com *.memba.com;
listen 80;
# Nginx security --------------
# http://www.nginxtips.com/nginx-security-guide/
# Hide nginx server signature
server_tokens off;
## Block download agents
if ($http_user_agent ~* LWP::Simple|wget|libwww-perl) {
return 403;
}
## Block some nasty robots
if ($http_user_agent ~ (msnbot|Purebot|Baiduspider|Lipperhey|Mail.Ru|scrapbot) ) {
return 403;
}
## Deny referral spam
if ( $http_referer ~* (jewelry|viagra|nude|girl|nudit|casino|poker|porn|sex|teen|babes) ) {
return 403;
}
# GZip --------------------------
# See http://nginx.org/en/docs/http/ngx_http_gzip_module.html
gzip on;
gzip_comp_level 2;
gzip_min_length 1024;
gzip_proxied any;
gzip_vary on;
# text/html is considered a duplicate in gzip_types
gzip_types text/plain text/css text/javascript application/javascript application/x-javascript application/json text/xml application/xml application/rss+xml application/atom+xml application/rdf+xml;
# Caching and buffering ---------
# https://www.digitalocean.com/community/tutorials/understanding-nginx-http-proxying-load-balancing-buffering-and-caching
# Locations ---------------------
# See http://nginx.org/en/docs/beginners_guide.html#conf_structure
# Timeouts ----------------------
send_timeout 600;
location / {
# pass any request to memba-blog containers
proxy_pass http://memba-blog;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-NginX-Proxy true;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
proxy_next_upstream error timeout http_503;
}
}
# -----------------------------------
# Kidoju server
# -----------------------------------
server {
server_name kidoju.com www.kidoju.com *.kidoju.com;
listen 80;
# Nginx security --------------
# http://www.nginxtips.com/nginx-security-guide/
# Hide nginx server signature
server_tokens off;
## Block download agents
if ($http_user_agent ~* LWP::Simple|wget|libwww-perl) {
return 403;
}
## Block some nasty robots
if ($http_user_agent ~ (msnbot|Purebot|Baiduspider|Lipperhey|Mail.Ru|scrapbot) ) {
return 403;
}
## Deny referal spam
if ( $http_referer ~* (jewelry|viagra|nude|girl|nudit|casino|poker|porn|sex|teen|babes) ) {
return 403;
}
# Redirect http traffic to https
# http://serverfault.com/questions/250476/how-to-force-or-redirect-to-ssl-in-nginx
# http://www.emind.co/how-to/how-to-force-https-behind-aws-elb
if ($http_x_forwarded_proto != 'https') {
return 301 https://www.kidoju.com$request_uri;
}
# GZip --------------------------
# See http://nginx.org/en/docs/http/ngx_http_gzip_module.html
gzip on;
gzip_comp_level 2;
gzip_min_length 1024;
gzip_proxied any;
gzip_vary on;
# text/html is considered a duplicate in gzip_types
gzip_types text/plain text/css text/javascript application/javascript application/x-javascript application/json text/xml application/xml application/rss+xml application/atom+xml application/rdf+xml application/svg+xml;
# Caching and buffering ---------
# https://www.digitalocean.com/community/tutorials/understanding-nginx-http-proxying-load-balancing-buffering-and-caching
# Locations ---------------------
# See http://nginx.org/en/docs/beginners_guide.html#conf_structure
# Timeouts ----------------------
send_timeout 600;
location /support/ {
# pass any request to kidoju-blog containers
proxy_pass http://kidoju-blog;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-NginX-Proxy true;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
proxy_next_upstream error timeout http_503;
}
location /api/ {
# pass any request to kidoju-server containers
proxy_pass http://kidoju-server;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-NginX-Proxy true;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
proxy_next_upstream error timeout http_503;
}
location /sitemap.xml {
# redirect permanently to kidoju-server sitemap
return 301 https://www.kidoju.com/api/v1/sitemap.xml$is_args$args;
}
location / {
# pass any request to kidoju-webapp containers
proxy_pass http://kidoju-webapp;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-NginX-Proxy true;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
proxy_next_upstream error timeout http_503;
}
}
# -----------------------------------
# Default (Memba) server
# -----------------------------------
server {
# server_name _;
listen 80 default_server;
return 301 http://www.memba.com.com$request_uri;
# Hide nginx server signature
server_tokens off;
}