Running multiple domains on one NGINX server

In addition to domain we have now registered domain for our planned business in Finland (mostly HW/SW consulting and financial and office management services).

As we are doing this part-time, we want to keep web hosting costs in control. Therefore we wanted to run the web pages of both domains on same server.

The original homepage of WestSloth Games ( has been running on single AWS Lightsail instance. In this solution, the monthly expenses are well-know in advance. But on the other hand server capacity is limited to some level. Anyways, the load for has not been too large for the Lightsail instance to handle it. So we thought we can easily run on same server too. webserver is built using NGINX, Gunicorn and Django framework plus local MySQL database. Web page is built using Bootstrap front-end framework.

Adding another domain to NGINX setup was done by following these instructions on applicable part:

First step that was required to get two separate domains running on same server was to divide original document root (/var/www/html) to two separate document roots (/var/www/ and /var/www/

Second step was to create new pages for, and that was basically copying Bootstrap template and remove all unnecessary parts there. This was placed under document root. Common static files like robots.txt were placed under document root.

In third step, original NGINX server block was duplicated (under nginx/sites-available). part was left mostly unmodified, because only changes were related to static file locations. server block was configured to listen port 80 and and server names. Also, document root and index was defined here.

Last step was to enable server blocks by creating symbolic links of nginx/sites-available to nginx/sites-enabled directory. NGINX will read these during the startup.

After restarting NGINX everything seemed to be working as expected. So now we can concentrate on editing the content of both web pages!



Popular posts from this blog

Unity3D: Convert Seconds to hh:mm:ss Format

Construct 2: if-then-elseif-else statement

Issue with Unity3D: "Found plugins with same names, and ."