Nginx 1 · Servers and static files

Serve a static site

A server block that serves files from a folder.

server {
    listen 80;
    server_name example.com www.example.com;
    root /var/www/example;
    index index.html;

    location / {
        try_files $uri $uri/ =404;
    }
}

Official Nginx 1 documentation

More servers and static files commands

All servers and static files commands · Nginx 1 cheatsheet

Was this page helpful?