Sharing config between two sites

I’ve got two sites, example.com and beta.example.com. The configuration
for these two sites is almost identical, except for the root directory
(/var/www/sitename/live/public/ for the first domain, and
/var/www/sitename/beta/public/ for the second domain) and a few
environment variables (database name, etc.) used by the code. What’s the
best way to share as much of the Nginx configuration as possible between
the two sites? Should I pull the common settings into an include file
and include it in both of the server blocks, or is there a better way?

Thanks!

  • Daniel

Posted at Nginx Forum: