I have this NGINX configuration as follows:
server {
listen 443;
server_name _;
ssl on;
ssl_certificate /var/lib/jelastic/SSL/jelastic.chain;
ssl_certificate_key /var/lib/jelastic/SSL/jelastic.key;
}
server {
listen 443 ssl;
server_name my-custom-domain-demo.xyz www.my-custom-domain-demo.com;
ssl_certificate /var/lib/nginx/ssl/my-custom-domain-demo.xyz/fullchain2.pem;
ssl_certificate_key /var/lib/nginx/ssl/my-custom-domain-demo.xyz/privkey2.pem;
}
The NGINX server receives requests with a host that has a template similar to *.shared-hosting.xyz, for example. website1.shared-hosting.xyz, website2.shared-hosting.xyz
as well as with variable hosts having different domains, for example my-custom-domain-demo.xyzor another-custom-domain-demo.xyzetc.
Now the problem is that the lower serverNGINX configuration overrides the upper configuration. With this, the upper part no longer works, and access to *.shared-hosting.xyzreturns a certificate error, and the browser reports that the certificate is intended only for my-custom-domain-demo.xyz.
What can be done with this so that lower NGINX configuration settings for domains *.shared-hosting.xyzand any other additional server configurations do not start when the host is in the template *.shared-hosting.xyz?