44 lines
977 B
Nginx Configuration File
44 lines
977 B
Nginx Configuration File
|
|
# nginx.conf
|
||
|
|
worker_processes auto;
|
||
|
|
|
||
|
|
events {
|
||
|
|
worker_connections 1024;
|
||
|
|
}
|
||
|
|
|
||
|
|
http {
|
||
|
|
# Logging
|
||
|
|
access_log /var/log/nginx/access.log;
|
||
|
|
error_log /var/log/nginx/error.log;
|
||
|
|
|
||
|
|
# Gzip compression
|
||
|
|
gzip on;
|
||
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||
|
|
gzip_min_length 256;
|
||
|
|
|
||
|
|
server {
|
||
|
|
listen 80;
|
||
|
|
server_name example.com;
|
||
|
|
|
||
|
|
root /var/www/;
|
||
|
|
index index.html;
|
||
|
|
|
||
|
|
# Error pages
|
||
|
|
#error_page 404 /404.html;
|
||
|
|
#location = /404.html {
|
||
|
|
# internal;
|
||
|
|
#}
|
||
|
|
|
||
|
|
# Serve static files
|
||
|
|
location / {
|
||
|
|
try_files $uri $uri/ =404;
|
||
|
|
}
|
||
|
|
|
||
|
|
# Optional: Caching for static assets
|
||
|
|
location ~* \.(?:ico|css|js|gif|jpe?g|png|svg|woff2?|ttf|otf|eot|html|xml|json)$ {
|
||
|
|
expires 10M;
|
||
|
|
access_log off;
|
||
|
|
add_header Cache-Control "public";
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|