Nginx conflicting server name for subdomain
Solution 1:
Looks to me like your https blocks need server names specified too e.g
server {
listen 443;
server_name bar.domain.com;
ssl on;
ssl_certificate [path_bar]/cacert.pem;
ssl_certificate_key [path_bar]/privkey.pem;
root [path]/bar;
}
Solution 2:
You may also have additional files in /etc/nginx/sites-available/<site-name>
that are linked to /etc/nginx/sites-enabled/<site-name>
.
The settings in those files may conflict with the /etc/nginx/sites-available/default
file