You could combine them into one line using a regex, but I would not
recommend it - it will be more complicated to maintain over time and
less readable. I would recommend putting all of your common
configuration directives into a separate file and including it in each
individual location block. Something like this:
location = /robots.txt {
include common-config.conf;
}
location = /sitemap.xml {
include common-config.conf;
}
…
I would also be sure to read the documentation on location syntax [0] to
understand the differences between exact, prefix, and regex matches so
you are sure to use the correct type for each pattern you are trying to
match.
Thanks Jon. I was desperately looking for a way to include this in the
same file and in my experience there are a lot of things like this that
are
not documented in the wiki elsewhere but Maxim, Sergey, Antonio etc.
seem
to know.