forked from bcgov/platform-developer-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
65 lines (52 loc) · 1.7 KB
/
nginx.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
# nginx.conf
# Adapted from https://cloud.redhat.com/blog/deploy-vuejs-applications-on-openshift
worker_processes auto;
pid /tmp/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
client_body_temp_path /tmp/client_temp;
proxy_temp_path /tmp/proxy_temp_path;
fastcgi_temp_path /tmp/fastcgi_temp;
uwsgi_temp_path /tmp/uwsgi_temp;
scgi_temp_path /tmp/scgi_temp;
server {
listen 8080;
server_name _;
port_in_redirect off;
gzip on;
gzip_types *;
index index.html;
error_log /tmp/error.log;
access_log /tmp/access.log;
error_page 404 /404.html;
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ =404;
}
# Caching rules from Gatsby: https://www.gatsbyjs.com/docs/caching/
# Page data files (and app-data.json) must always be checked for freshness.
location /page-data {
root /usr/share/nginx/html;
add_header Cache-Control "public, max-age=0, must-revalidate";
}
# Static assets should be cached forever, as Gatsby uses unique file paths
# tied to content versions.
location /static {
root /usr/share/nginx/html;
add_header Cache-Control "public, max-age=31536000, immutable";
}
# JavaScript and CSS files generated by webpack should be cached forever.
location ~* \.(?:js|css)$ {
root /usr/share/nginx/html;
add_header Cache-Control "public, max-age=31536000, immutable";
}
# If using a service worker, the service worker file needs to be revalidated
# on each load to make sure site content is fresh.
location = /sw.js {
add_header Cache-Control "public, max-age=0, must-revalidate";
}
}
}