atom feed6 messages in ru.sysoev.nginxRe: same config for two virtual hosts...
FromSent OnAttachments
Gelonida NNov 23, 2011 2:23 pm 
António P. P. AlmeidaNov 23, 2011 2:50 pm 
Gelonida NNov 23, 2011 3:20 pm 
António P. P. AlmeidaNov 23, 2011 3:29 pm 
Gelonida NNov 23, 2011 3:35 pm 
António P. P. AlmeidaNov 23, 2011 3:42 pm 
Subject:Re: same config for two virtual hosts (except hostname / certificate)
From:António P. P. Almeida (ap@perusio.net)
Date:Nov 23, 2011 2:50:32 pm
List:ru.sysoev.nginx

On 23 Nov 2011 22h23 WET, gelo@gmail.com wrote:

Hi,

I'm still a little shaky with how to best structure my nginx configurations and where one can / should use includes and where one couldn't.

somehow I like the idea of a directory structure like

/etc/nginx/ # for basic files / certificates / . . . /etc/nginx/sites-available # the available configs /etc/nginx/sites-enabled # the sites, that shall really be started

Now I have two sites (ssl which should share exactly the same config (except the host name and the server certificate) the first one would be for example server_1.mysite.net the other server_2.mysite.net:4433

Of course both would need their own certificate and host name.

What would be the recommended way for such a setup?

My suggestion is for you to place the common things in both vhosts in a file, e.g., my_common_config.conf and do an include in each vhost:

server_1.mysite.net.conf server_2.mysite.net.conf

You can try this script for enabling each site and disabling using the sites_enabled/sites-available layout.

https://github.com/perusio/nginx_ensite

--- appa