Here is the problem: I have two domains which have pointed to two available IPs on a server. Say:
siteone.com pointed to 1.2.3.4 sitetwo.com pointed to 1.2.3.5
What I did to configure nginx vhosts was to put
server {
listen site1.com:80; #
server_name site1.com www.site1.com;
on vhost1 file and
server {
listen site2.com:80; #
server_name site2.com www.site2.com;
on a (separate) vhost2 file. The two vhost files are exact replicates expect the site1 and site2 paths, of course. And vhost1 is working well on its own.
However after restarting nginx I get this error:
Restarting nginx: the configuration file /etc/nginx/nginx.conf syntax is ok [emerg]: bind() to 1.2.3.5:80 failed (99: Cannot assign requested address) configuration file /etc/nginx/nginx.conf test failed
When I put
server {
listen *:80; #
server_name site2.com www.site2.com;
On site2 vhost, the nginx restarts without error but does not render pages on site2 path.
I'm confused and appreciate your help.
Try this: