-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.tmpl
More file actions
86 lines (67 loc) · 2.38 KB
/
nginx.tmpl
File metadata and controls
86 lines (67 loc) · 2.38 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
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
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
gzip on;
gzip_disable "msie6";
gzip_vary off;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript application/octet-stream text/xml application/xml application/xml+rss text/javascript;
# Port 79 brukes fra ELB port 80 for å hindre http (redirigere til https)
server {
listen 79;
return 301 https://$host$request_uri;
}
# Port 80 brukes fra ELB port 443
server {
listen 80;
charset UTF-8;
add_header X-Cache-Status $upstream_cache_status;
error_log /var/log/nginx/error.log debug;
access_log /var/log/nginx/access.log;
resolver 127.0.0.11;
set $gdl_frontend 'gdl-frontend.gdl-local';
set $admin_frontend 'admin-frontend.gdl-local';
location ~* ^/(sitemap.*) {
set $s3_bucket 's3.eu-central-1.amazonaws.com/sitemap.gdl';
set $sitemap_url 'https://$s3_bucket/$1?';
proxy_http_version 1.1;
proxy_set_header Referer 'gdl_proxy';
proxy_pass $sitemap_url;
}
location ~* ^/health$ {
add_header 'Content-Length' 0;
return 200;
}
# For assets, we strip away the 'admin' part of the url
location ~ ^/admin/_next/(.+) {
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;
proxy_set_header Forwarded "for=$remote_addr;proto=$http_x_forwarded_proto";
proxy_pass http://$admin_frontend/_next/$1$is_args$args;
}
# For everything else admin, just pass on the request
location /admin {
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;
proxy_set_header Forwarded "for=$remote_addr;proto=$http_x_forwarded_proto";
proxy_pass http://$admin_frontend;
}
location / {
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;
proxy_set_header Forwarded "for=$remote_addr;proto=$http_x_forwarded_proto";
proxy_pass http://$gdl_frontend;
}
}
}