46 lines
No EOL
1.3 KiB
Nginx Configuration File
46 lines
No EOL
1.3 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
# Listen for incoming connections on port 80
|
|
|
|
server_name _;
|
|
# Accept requests from any domain name
|
|
|
|
root /usr/share/nginx/html;
|
|
# Set the directory where our app files are located
|
|
|
|
index index.html;
|
|
# Serve index.html as the default page
|
|
|
|
# Enable gzip
|
|
gzip on;
|
|
# Turn on compression for files
|
|
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
|
# Specify which file types to compress
|
|
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
# Try to find the requested file, if not found serve index.html
|
|
}
|
|
|
|
# Cache static assets
|
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
|
# Match files with these extensions
|
|
|
|
expires 1y;
|
|
# Set files to expire in 1 year
|
|
|
|
add_header Cache-Control "public, immutable";
|
|
# Tell browsers these files never change, cache them permanently
|
|
}
|
|
}
|
|
|
|
# It compresses files to save bandwidth and caches assets.
|
|
|
|
# The try_files rule ensures Flutters client-side routing works correctly.
|
|
|
|
# Finds the right files and sends them to the browser
|
|
|
|
# Compresses files to make them download faster
|
|
|
|
# Tells browsers to cache files so they load instantly on repeat visits |