forked from cloud-gov/pages-redirects
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf.njk
67 lines (55 loc) · 2.16 KB
/
nginx.conf.njk
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
worker_processes 1;
{% if not IS_DOCKER %}
daemon off;
{% endif %}
events { worker_connections 1024; }
http {
charset utf-8;
log_format cloudfoundry '$http_x_forwarded_for - $http_referer - [$time_local] "$request" $status $body_bytes_sent';
{% if not IS_DOCKER %}
port_in_redirect off; # Ensure that redirects do not include the internal container PORT
{% endif %}
default_type application/octet-stream;
include mime.types;
sendfile on;
gzip on;
gzip_disable "msie6";
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gunzip on;
gzip_static always;
gzip_types text/plain text/css text/js text/xml text/javascript application/javascript application/x-javascript application/json application/xml application/xml+rss;
tcp_nopush on;
keepalive_timeout 30;
server_tokens off;
server {
listen {{ PORT }};
server_name pages.18f.gov;
# -- Redirects for pages.18f.gov sites
{% for page in PAGE_CONFIGS %}
rewrite (?i)^/{{ page.from }}(\/.*)?$ https://{{ page.to }}.{{ page.toDomain }}{{ page.toPath }}$1;
{% endfor %}
# -- end redirects for pages.18f.gov sites
# -- Custom pages.18f.gov redirects from the old federalist-redirects app
# Ref: https://github.com/18F/federalist-redirects/blob/b60293b49d01c429092195bc6d446690423dcf3b/nginx.conf#L85-L89
rewrite ^/intake/.* https://18f.gsa.gov/contact/ redirect;
rewrite ^/designstandards/.* https://standards.usa.gov/ redirect;
rewrite ^/joining-18f/.* https://18f.gsa.gov/join/ redirect;
# -- end custom pages.18f.gov redirects
# For everything else, show an error message
location / {
# Return a not found error
return 404 "<h1>Page Not Found</h1>
<p>If you are looking for a site previously on 18F Pages
that you think should still exist, please send a message to
<a href='mailto:[email protected]'>[email protected]</a>.
</p>";
default_type text/html;
}
}
# -- Custom domain redirects for various Federalist-hosted sites
{% include "_federalist-redirects.njk" %}
# -- end custom domain redirects
}