0

I have 2 Joomla sites and would like them to both appear as one domain. Ideally, a request would come in and if the URL matches the first site it would go to the page. If the first site returns a 404 then redirect to the second site. I started by matching /home in the second location block as I would like that to go to the homepage for the second site but it just times out.

Here is my config for the site:


server {
  listen 8090;
  server_name cdslanding.com;
  root   /var/local/benndev/cds;
  include /etc/nginx/joomla.conf;
}
server {
  listen 8090;
  server_name cdshome.com;
  root   /var/local/benndev/cds_home;
  include /etc/nginx/joomla.conf;
}
server {
  listen 80;
  server_name cdsmaster.com;
  location / {
    include /etc/nginx/proxy.conf;
    proxy_pass http://cdslanding.com:8090;
  }
   location /home {
     include /etc/nginx/proxy.conf;
     proxy_pass http://cdshome.com:8090;
  }

}

1 Answer 1

0

You probably need to add a line to /etc/hosts:

127.0.0.1  cdslanding.com cdshome.com

The proxy_pass statement is now probably leading to nginx trying to connect to the public IP that a DNS lookup for cdslanding.com and cdshome.com gives; but you want it to connect to the local host. The /etc/hosts line will do that.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .