28 lines
704 B
Nginx Configuration File
28 lines
704 B
Nginx Configuration File
server {
|
|
listen 80;
|
|
|
|
# Compression
|
|
gzip on;
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
|
|
|
# Root directory and index file
|
|
root /usr/share/nginx/html;
|
|
index index.html index.htm;
|
|
|
|
# Handle React Router
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# Cache static assets
|
|
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg)$ {
|
|
expires 30d;
|
|
add_header Cache-Control "public, no-transform";
|
|
}
|
|
|
|
# Error pages
|
|
error_page 500 502 503 504 /50x.html;
|
|
location = /50x.html {
|
|
root /usr/share/nginx/html;
|
|
}
|
|
}
|