42 lines
1.1 KiB
Nginx Configuration File
42 lines
1.1 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name localhost;
|
|
# define root globally so all location blocks (images, css, etc) inherit it
|
|
root /usr/share/nginx/html;
|
|
index index.html index.htm;
|
|
# gzip compression
|
|
gzip on;
|
|
gzip_types text/plain text/css application/json application/javascript text/xml appl>
|
|
gzip_vary on;
|
|
gzip_min_length 1000;
|
|
|
|
# assets (images, fonts, favicons) - cache for 1 Year
|
|
location ~* \.(jpg|jpeg|gif|png|ico|svg|woff|woff2|ttf|eot)$ {
|
|
expires 365d;
|
|
add_header Cache-Control "public, no-transform";
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# code (css, js) - cache for 1 month
|
|
location ~* \.(css|js)$ {
|
|
expires 30d;
|
|
add_header Cache-Control "public, no-transform";
|
|
try_files $uri =404;
|
|
}
|
|
|
|
# standard routing - short cache
|
|
location / {
|
|
try_files $uri $uri/ $uri.html =404;
|
|
}
|
|
|
|
# error page
|
|
error_page 404 /404.html;
|
|
|
|
location = /404.html {
|
|
internal ;
|
|
}
|
|
|
|
# logging / lb config
|
|
real_ip_header X-Forwarded-For;
|
|
set_real_ip_from 10.0.0.0/8;
|
|
} |