# Sharing config between two sites

**URL:** <https://www.ruby-forum.com/t/sharing-config-between-two-sites/220511>\
**Category:** NGINX\
**Created:** [June 12, 2012, 6:02am UTC](https://www.ruby-forum.com/t/sharing-config-between-two-sites/220511 "2012-06-12T06:02:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [June 12, 2012, 6:02am UTC](https://www.ruby-forum.com/t/sharing-config-between-two-sites/220511/1 "2012-06-12T06:02:50Z")

</div>

I’ve got two sites, [example.com](http://example.com) and [beta.example.com](http://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:

> **[Sharing config between two sites](https://forum.nginx.org/read.php?2,227445,227445#msg-227445)**
>
> 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...
