Multi Domain Website On Two Linode VPS Nginx Server

I need help to setup a multi domain site on two VPS server with Linode. I will try to explain exactly what I want to achieve with setup.

When user visits site.com the html site well be displayed but if the user clicks on site.com/blog the user will see the Wordpress blog posts with in the specific language.

I want domain site.com to listen to both VPS servers depending on the request from the user. If the user clicks on about.html page the static site will be shown but if the user clicks on a blog post the user will see the post from the Wordpress site with the specific language.

**

Basically i want the main domain to always show static website but when a URL for the domain is site.com/blog-post-from-wordpress-on-server-b then it will show the Wordpress website.

**

The setup look like this.

VPS server A hosting 5 html static websites.

(Nginx server on Ubuntu 14.04 LTS x64)

site.com

site.se

site.dk

site.no

site.de

VPS server B hosting Wordpress Blog site.

(LEMP on Ubuntu 14.04 LTS x64)

site.com

Wordpress will be multilingual site pointing to domains with plugin WPML or Polylang

site.com/blog-post

site.se/blog-post-in-swedish

etc…

The both server are running Nginx with two different IP address

All domains are handle by cloudflare DNS

So far i have manage to show blog posts on url site.com/post-in-english/ but when i go to site.com the wordpress site is showing instead of the static html site and sometimes the static page depending on DNS relay for the IP addresses.

The DNS looks like this for site.com

@ A VPS server A IP pointing to var/www/site.com/html

@ A VPS server A IP pointing to /var/www/site.com/htdocs

Somehow it must go to configure this with NGINX server block file for each site.

Server Block for site.com on server A static html website

server {
      listen 80;
      listen [::]:80;

      server_name site.com www.site.com;

      if ($host = 'site.com' ) {
              rewrite  ^/(.*)$  http://www.site.com/$1  permanent;
      }

      root /var/www/site.com/html;
      index index.html index.htm;

      location / {
        try_files $uri $uri/ =404;
      }
}

Server Block for site.com on server B for Wordpress

server {

    server_name site.com   www.site.com;

    access_log /var/log/nginx/site.com.access.log rt_cache;
    error_log /var/log/nginx/site.com.error.log;

    root /var/www/site.com/htdocs;

    index index.php index.html index.htm;

    include common/wpfc.conf;

    include common/wpcommon.conf;
    include common/locations.conf;
    include /var/www/site.com/conf/nginx/*.conf;
}

1 Reply

This seems fairly complicated to set-up. Static pages take fairly little resources to serve, is there any reason why you can't do it on the same server? Perhaps set it up on the same server, then make it highly available across two Linodes and clone all the content?

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct