32 lines
994 B
Nginx Configuration File
32 lines
994 B
Nginx Configuration File
|
|
server {
|
||
|
|
listen 80;
|
||
|
|
server_name localhost;
|
||
|
|
|
||
|
|
# Root directory and index file
|
||
|
|
root /usr/share/nginx/html;
|
||
|
|
index index.html;
|
||
|
|
|
||
|
|
# Handle SPA routing
|
||
|
|
location / {
|
||
|
|
try_files $uri $uri/ /index.html;
|
||
|
|
}
|
||
|
|
|
||
|
|
# Cache control for static assets
|
||
|
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
||
|
|
expires 1y;
|
||
|
|
add_header Cache-Control "public, max-age=31536000, immutable";
|
||
|
|
try_files $uri =404;
|
||
|
|
}
|
||
|
|
|
||
|
|
# Enable CORS for WordPress integration
|
||
|
|
add_header 'Access-Control-Allow-Origin' '*';
|
||
|
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||
|
|
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
|
||
|
|
|
||
|
|
# Gzip compression
|
||
|
|
gzip on;
|
||
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||
|
|
gzip_comp_level 6;
|
||
|
|
gzip_min_length 1000;
|
||
|
|
}
|