I just did a lemp setup but I can’t get my virtual hosts to work
I´m totally lost and out of ideas.
Two domains and one starting on e is always responding showing its root
the other starting on s is just dead. I understand that nginx is
this as Apache analyzing the headers for a match and if no match it goes
alphabetically taking the first as default domain.
I have my configuration files in /etc/nginx/conf.d, domain1.conf and
domain2.conf and the root pointing to /var/www/domain1/html and
The domains are pointed A records to my public IP
What can be wrong here? So many people having this problem but I can´t
a solution. I hope this forum are holding cutting edge professionals to
I am using a setup with a bunch of domains - where I am just using the
As far as I can see, your config looks ok. But you have to keep in mind
one thing: the “default” property, AND if it is being accessed through a
proxy. That can - I am no expert! - possibly be a cause.
So in general, first delete - or change - the sites-enabled/default
file. Remove the “default” keyword in the “listen” entry. Why? Well, it
tends to cause NGINX to prefer one domain over another, and afaik,
having multiple of these can even lead to an error, or unexpected
behavior. Then, create files for your domains in the sites-available
folder, and symlink them to sites-enabled. I wish there was a tool for
that honestly… But first creating your configs in sites-available gives
you a listing of all the sites you could offer. Again, check for the
default keyword. Then symlink them - with their full path, not relative!