Configuring a Linux VPS: Multi-site NGINX Server

1 Minute(s) to read


The following article describes how to configure a Linux Virtual Private Server (VPS) running on a modern version of Ubuntu (18.04.2 LTS is preferable), so that it can host multiple websites (virtual hosts) from a single instance of NGINX. This is suitable for readers who have access to a Digital Ocean or Linode Virtual Private Server instance, as an example.

You might be interested in reading this blog post that talks about configuring your VPS instance for secure file uploads.


NGINX can be easily installed on Ubuntu by running the following command.

sudo apt-get install nginx --yes

Once installation has completed, the NGINX service will automatically run and begin listening on port 80.

Use the following command to verify that it is running.

ps aux | grep nginx

Then, navigate to the IP address of your virtual private server to verify that it is running as expected.

Directory Structure

By default, NGINX uses the following directory as the root for serving pages from.


Should you have multiple types of web server applications running from the same server, I would recommend creating a sub-directory called "nginx", and using that as the root for serving pages for NGINX.


Update your configuration file for NGINX to ensure that it configured as such.

The root configuration file can be found at the following path.





Create the directories for your website.



That was a lot of work.

Fortunately, there is a way to automate all of this through a simple bash script. You might find the following script useful for automating this whole process.

It does the following:

  1. Creates a new directory for your website.
  2. Creates a new user and user group for serving your website with.
  3. Creates the directories that are to be used for recording application loggin.