Code
nginx
# /etc/nginx/conf.d/example.conf
server {
listen 80;
server_name example.com www.example.com;
root /var/www/example;
index index.html index.htm;
# Default location
location / {
try_files $uri $uri/ /index.html;
}
# Static assets caching
location ~* \.(css|js|png|jpg|svg|woff2)$ {
expires 7d;
add_header Cache-Control "public, no-transform";
}
# Custom error page
error_page 404 /404.html;
location = /404.html {
internal;
}
}