32 lines
681 B
Nginx Configuration File
32 lines
681 B
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
# Root directory for React app
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Serve static files with caching
|
|
location ~* ^.+\.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
|
expires 1y;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
|
|
# SPA routing - route all requests to index.html
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# Health check endpoint
|
|
location /health {
|
|
access_log off;
|
|
return 200 "ok";
|
|
add_header Content-Type text/plain;
|
|
}
|
|
|
|
# Deny access to hidden files
|
|
location ~ /\. {
|
|
deny all;
|
|
}
|
|
}
|