-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnginx.conf.example
More file actions
32 lines (26 loc) · 894 Bytes
/
nginx.conf.example
File metadata and controls
32 lines (26 loc) · 894 Bytes
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
# Nginx configuration for SPA (Single Page Application)
# Place this configuration in your nginx server block
server {
listen 80;
server_name test.copus.network;
root /path/to/copus-network/dist;
index index.html;
# Enable gzip compression
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml+rss application/json;
# Serve static files directly
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
try_files $uri =404;
}
# Handle all routes by serving index.html
# This is the key configuration for SPA routing
location / {
try_files $uri $uri/ /index.html;
}
# Optional: Handle 404 errors
error_page 404 /index.html;
}