-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnginx.conf
More file actions
60 lines (49 loc) · 1.92 KB
/
nginx.conf
File metadata and controls
60 lines (49 loc) · 1.92 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
# Increase map hash bucket size for large map values
map_hash_bucket_size 128;
# Redirect mappings from old prod site to new stage site
# Path-only format: works across all environments
map $uri $redirect_uri {
/deploy-applications/deploy-hello-world-to-glueops /deploy-applications/deploy-first-app;
/deploy-applications/deploy-python-app-to-glueops /deploy-applications/deploy-first-app;
/deploy-applications/deploy-docusarus-website-to-glueops /deploy-applications/deploy-first-app;
/deploy-applications/adding-configurations-and-secrets-to-the-hello-world-app-glueops-platform /deploy-applications/manage-environment-secrets;
}
# Disable robots/SEO crawling for non-prod environments
map $host $robots_disallow {
default "noindex, nofollow";
docs.glueops.dev "index, follow";
}
# robots.txt content based on environment
map $host $robots_content {
default "User-agent: *\nDisallow: /\n";
docs.glueops.dev "User-agent: *\nAllow: /\n";
}
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# Add noindex/nofollow header for non-prod environments
add_header X-Robots-Tag $robots_disallow;
location = /robots.txt {
default_type text/plain;
return 200 $robots_content;
}
location / {
# Apply explicit redirects for old prod paths
if ($redirect_uri != "") {
return 301 $scheme://$host$redirect_uri;
}
# SPA fallback: serve index.html for client-side routing
try_files $uri $uri/ /index.html;
}
# Cache static assets
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# Gzip compression
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml;
gzip_min_length 256;
}