2021-12-08 23:08:16 +00:00
|
|
|
# auto detects a good number of processes to run
|
|
|
|
|
worker_processes auto;
|
|
|
|
|
|
|
|
|
|
#Provides the configuration file context in which the directives that affect connection processing are specified.
|
|
|
|
|
events {
|
|
|
|
|
# Sets the maximum number of simultaneous connections that can be opened by a worker process.
|
2024-12-01 08:55:15 +00:00
|
|
|
worker_connections 1024;
|
2021-12-08 23:08:16 +00:00
|
|
|
# Tells the worker to accept multiple connections at a time
|
|
|
|
|
multi_accept on;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2021-12-08 22:25:02 +00:00
|
|
|
http {
|
2021-12-08 23:08:16 +00:00
|
|
|
# what times to include
|
|
|
|
|
include /etc/nginx/mime.types;
|
|
|
|
|
# what is the default one
|
|
|
|
|
default_type application/octet-stream;
|
|
|
|
|
|
|
|
|
|
# Sets the path, format, and configuration for a buffered log write
|
|
|
|
|
log_format compression '$remote_addr - $remote_user [$time_local] '
|
|
|
|
|
'"$request" $status $upstream_addr '
|
|
|
|
|
'"$http_referer" "$http_user_agent"';
|
|
|
|
|
|
2021-12-25 02:12:17 +00:00
|
|
|
gzip on;
|
|
|
|
|
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
|
|
|
|
|
gzip_vary on;
|
2021-12-25 02:25:54 +00:00
|
|
|
gzip_proxied any;
|
2025-03-11 07:40:57 +00:00
|
|
|
gzip_comp_level 9;
|
|
|
|
|
gzip_buffers 10 8k;
|
2021-12-25 02:25:54 +00:00
|
|
|
gzip_http_version 1.1;
|
2024-12-01 08:55:15 +00:00
|
|
|
gzip_types text/plain text/css text/xml text/javascript image/webp image/svg+xml image/x-icon application/javascript application/x-javascript application/json application/xml application/xml+rss;
|
2021-12-25 02:12:17 +00:00
|
|
|
|
2021-12-08 23:08:16 +00:00
|
|
|
server {
|
|
|
|
|
# listen on port 80
|
|
|
|
|
listen 80;
|
|
|
|
|
# save logs here
|
|
|
|
|
access_log /var/log/nginx/access.log compression;
|
|
|
|
|
|
2022-05-30 18:38:51 +01:00
|
|
|
# where's the root dir
|
2021-12-08 23:20:18 +00:00
|
|
|
root /usr/share/nginx/html;
|
2022-05-30 18:38:51 +01:00
|
|
|
# what file to serve as index
|
2021-12-08 23:08:16 +00:00
|
|
|
index index.html index.htm;
|
|
|
|
|
|
|
|
|
|
location / {
|
|
|
|
|
# First attempt to serve request as file, then
|
|
|
|
|
# as directory, then fall back to redirecting to index.html
|
|
|
|
|
try_files $uri $uri/ /index.html;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Media: images, icons, video, audio, HTC
|
2022-02-23 19:38:23 +00:00
|
|
|
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc|webp)$ {
|
2022-01-15 12:53:36 +00:00
|
|
|
expires 1y;
|
2021-12-08 23:08:16 +00:00
|
|
|
access_log off;
|
|
|
|
|
add_header Cache-Control "public";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Javascript and CSS files
|
|
|
|
|
location ~* \.(?:css|js)$ {
|
|
|
|
|
try_files $uri =404;
|
2022-01-15 12:58:25 +00:00
|
|
|
expires 1y;
|
2021-12-08 23:08:16 +00:00
|
|
|
access_log off;
|
|
|
|
|
add_header Cache-Control "public";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Any route containing a file extension (e.g. /devicesfile.js)
|
|
|
|
|
location ~ ^.+\..+$ {
|
|
|
|
|
try_files $uri =404;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-12-08 22:25:02 +00:00
|
|
|
}
|