Multiple SSL web sites with nginx

Ian Hobson hobson42 at gmail.com
Sun Jul 12 19:08:08 UTC 2020



On 12/07/2020 17:43, Bee.Lists wrote:
> 
>> On Jul 12, 2020, at 9:43 AM, dorafmon <nginx-forum at forum.nginx.org> wrote:
>>
>> I am trying to host multiple web apps on the same machine and they are all
>> SSL enabled. I am trying to put an Nginx server in front of them to redirect
>> incoming requests to different ports.
> 
> The domain carried forward is what nginx uses to decipher what vhost to return. Also, both of those domains are port 443, so it will go to the first/default domain.
> 
This is not correct, see 
https://nginx.org/en/docs/http/ngx_http_core_module.html#server where it 
says

Syntax:	server { ... }
Default:	—
Context:	http
Sets configuration for a virtual server. There is no clear separation 
between IP-based (based on the IP address) and name-based (based on the 
“Host” request header field) virtual servers. Instead, the listen 
directives describe all addresses and ports that should accept 
connections for the server, and the server_name directive lists all 
server names.

So the ports are defined in the listen directive, and the server names 
in the server_name directive.

Your approach of multiple https servers works fine on my kit with the 
approach you have taken.

Suggest there may be a typo in your configuration - try

sudo nginx -t

to prove both servers are loaded.


Regards

Ian

-- 
Ian Hobson
Tel (+351) 910 418 473

-- 
This email has been checked for viruses by AVG.
https://www.avg.com



More information about the nginx mailing list