0

I have a subdomain for which only 1 single file will ever be served for any and all purposes.

Sample Reference:

server{
    listen          80;
    server_name     one.example.com;
    return          200 'hello';
}

Instead of a string, what would be the most efficient/otherwise best way to server an .html file?
Or is this:

server{
    listen          80;
    server_name     one.example.com;
    location * {
        root /home/;
        try_files /one.html /one.html;
    }
}

as simple as it gets?

House3272
  • 169
  • 1
  • 5

1 Answers1

0

I don't think you can make it much more efficient, but I have a couple of minor tweaks:

  • "location /" rather than "location *" could be marginally more efficient, if it suits your needs
  • your try_files doesn't need to list the same file twice
  • your OS will likely cache the file, but you could make a ram disk - on Centos I use /dev/shm
  • you could put CloudFlare or another CDN in front of it, so it's served from a global network of servers. If you use CF you would need to configure it to "cache everything" mode - html is not cached by default.
Tim
  • 31,888
  • 7
  • 52
  • 78