Problem about config one virtual host with separated server blocks

Is it possible to write a config like this?

server {
server_name www.example.com;
location / {

}
}

server {
server_name www.example.com;
listen 143;
ssl on;
ssl_certificate example.crt;
ssl_certificate_key example.key;
}

That means I can config one domain with two separated server blocks.
This feature is handy thus I can write a config auto-gen script.

Thanks.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,127215,127215#msg-127215

On Sat, Sep 04, 2010 at 11:52:28PM -0400, speedfirst wrote:

Is it possible to write a config like this?

server {
server_name www.example.com;
location / {

}
}

server {
server_name www.example.com;
listen 143;
ssl on;
ssl_certificate example.crt;
ssl_certificate_key example.key;
}

That means I can config one domain with two separated server blocks.
This feature is handy thus I can write a config auto-gen script.

http://nginx.org/en/docs/http/configuring_https_servers.html#single_http_https_server


Igor S.
http://sysoev.ru/en/

Thanks for the reply, but I’m think you misunderstand my question. The
question is NOT whether I can use multiple “server” blocks. What I to
know is whether Nginx will merge multiple “server” blocks, which share
the same listen and server name, into the single one. This is just like
the “partial class” grammar in C#.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,127215,127489#msg-127489

On Sun, Sep 05, 2010 at 09:56:08PM -0400, speedfirst wrote:

Thanks for the reply, but I’m think you misunderstand my question. The
question is NOT whether I can use multiple “server” blocks. What I to
know is whether Nginx will merge multiple “server” blocks, which share
the same listen and server name, into the single one. This is just like
the “partial class” grammar in C#.

No, nginx does not merge server blocks.
nginx merges only “http” > “server” > “location”.


Igor S.
http://sysoev.ru/en/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs