Back to search

nginx server block

config web

Nginx virtual host / server block configuration

/etc/nginx/sites-available/{server_name}

Required Packages

sudo apt install -y nginx

Server Settings

Domain name or _ for default

Add listen [::]:port directives

Handle requests when no other server_name matches

Used for static file serving mode

SSL/TLS

Performance

Space-separated MIME types to compress

Max upload size (e.g. 1m, 10m, 100m)

Logging

Generated Config — /etc/nginx/sites-available/{server_name}

server { listen 80; listen [::]:80; server_name _; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; client_max_body_size 10m; gzip on; gzip_types text/plain text/css application/json application/javascript text/xml application/xml; root /var/www/html; index index.html index.htm; location / { try_files $uri $uri/ =404; } }