How to Set up Multiple Websites on Ubuntu 18.04 VPS with Apache

Apache is one of the best open-source web servers that run millions of sites on the web. It is very fast, secure, flexible, and takes minutes to set up on a Linux server e.g., Ubuntu 18.04.

If you have purchased a VPS plan, there are high chances that you want to run multiple websites on your server. This will reduce additional costs which you would have incurred to deploy additional VPS machines.

Running multiple websites is possible on a single Ubuntu 18.04 server because Apache comes with a feature known as Virtual hosts that allows you to configure unlimited websites on a single server.

In this guide, we will take you through the steps of configuring multiple websites on your Ubuntu 18.04 with Apache.


To follow along with the guide, you will require the following:

  1. A VPS account. Sign up with Digital Ocean today and get up to $100 worth of free credit to test this article and other cloud products.
  2. A non-root user account that can perform sudo tasks on your VPS server.

For better clarification, we will set up two domains: and on the server.

Step 1: Installing Apache Web Server

The first step is installing the web server. We will use Ubuntu apt manager to install Apache.

First,  update the package information index:

$ sudo apt-get update

Then, install Apache

$ sudo apt-get install apache2

Press Y and hit Enter when prompted to confirm the installation.

Once installed, you can enter the IP address associated with your VPS machine on a web browser like Google Chrome. If the Apache installation was completed successfully, you should see a page similar to the one shown below:

Step 2: Creating the First Virtual Host on Ubuntu 18.04 Server

Apache creates a virtual host when installed for the first time. The configuration file can be located at /etc/apache2/sites-available/000-default.conf. To avoid any conflicts, we need to  disable the virtual host by running the command below.

$ sudo a2dissite 000-default.conf

Next, create a virtual host configuration for the domain.

$ sudo mkdir -p /var/www/

Next,  we will change the ownership of the directory that we have created above.

$ sudo chown -R $USER:$USER /var/www/

Then,  issue the right file permissions to the directory.

$ sudo chmod -R 755 /var/www/

Also, to ensure that newly created files and directories inherit the permissions we  created above, we are going to run the command below:

$ sudo find /var/www/ -type d -exec chmod g+s {} \;

Once we have the directory for the website in place, we can create a new virtual host configuration file and reference to that directory:

$ sudo nano /etc/apache2/sites-available/

Paste the information below:

<VirtualHost *:80>

    DocumentRoot /var/www/
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

<Directory /var/www/>

Options -Indexes +FollowSymLinks -MultiViews
AllowOverride All          
Require all granted



Next, enable the virtual host by running the command below.

$ sudo a2ensite

We can create a sample home page for the website. So, create the file using nano text editor:

$ sudo nano /var/www/

Paste the information below in the file.

    <title>Site 1</title>
    <h1>This is a sample page for website</h1>

Step 3: Creating the Second Virtual Host on Ubuntu 18.04 Server

Just like we have done for the website, we need to create a directory for the virtual host on Apache.

$ sudo mkdir -p /var/www/

Then we need to change the file ownership and associate them to the currently logged in user.

$ sudo chown -R $USER:$USER /var/www/

Then, run the command below to issue the right permissions.

$ sudo chmod -R 755 /var/www/

Make sure that files created under the directory inherit permissions from the parent directory.

$ sudo find /var/www/ -type d -exec chmod g+s {} \;

Create a virtual host file for the website.

$ sudo nano /etc/apache2/sites-available/

Then, paste the information below.

<VirtualHost *:80>
    DocumentRoot /var/www/
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

<Directory /var/www/>

Options -Indexes +FollowSymLinks -MultiViews
AllowOverride All           
Require all granted



Close and save the file by pressing CTRL+X, Y and hit Enter.

Next, enable the virtual host by running the command below:

$ sudo a2ensite

Next, create a sample home page for the website.

$ sudo nano /var/www/

Enter the information below;



    <title>Site 2</title>



    <h1>This is a sample page for website</h1>



Press CTRL+X, Y and Enter to save the file.

Step 3: Restart Apache and Test the Configuration

In order for Apache to load the settings for the newly created virtual hosts, it must be restarted.

$ sudo systemctl restart apache2

Then, on your local computer, add the and domain names on the hosts file and point them to the public IP address of your VPS machine and save the file.

If you are running Windows, edit the file c:\Windows\System32\Drivers\etc\hosts and save it. Remember to replace with the IP address associated with your VPS machine:

# Copyright (c) 1993-2009 Microsoft Corp.


# localhost name resolution is handled within DNS itself.

#          localhost

#             ::1             localhost


Then, save the file and visit the on your browser. You should see a page similar to the one below:

Next, visit on your browser to test the 2nd virtual host. Your browser should display the page shown below.


That’s all when it comes to hosting multiple sites on your Ubuntu 16.04 server with Apache. A virtual host is a great feature that you can leverage to reduce cost of ownership when you wish to run multiple sites on a single VPS machine.

Remember, you can configure as many websites as you want provided your VPS plan can handle the disk space, memory, and bandwidth.

The virtual hosts configuration should work pretty well on any Digital Ocean server.  Sign up with Digitial Ocean today and get $100 worth of free trial credit.

5 Tips for Choosing the Best Cheap Domain and Hosting Provider

While it might sound simple, choosing a cheap domain and hosting provider can be a tricky process. There are thousands of cheap web hosting services provider and choosing the best may be somehow confusing.  Let me show you the fool proof method that you can use to select the best and cheap web hosting company.

Tip # 1: Identify the top 5 reputable companies

A simple Google search for the term “top hosting providers” will bring you some good results about the best players in the world of hosting. For instance, at the time of writing this guide, I came up with the below list:

Of course when it comes to the best web hosting providers, you must review their features. To come up with the list above, I considered the following:

  • Online reputation – what the other customers think about the hosting companies
  • Customer support –availability of email, phone and live chat as well as response time
  • Product features including emails, SSD disk space, unlimited domains, PHP and MySQL support, free script installers, Cpanel, e.t.c

Tip # 2: Tabulate the companies together with their yearly subscription fees

In order to get a good overview of top cheap web hosting, you must compare the pricing of the hosting companies on a yearly basis.

Another thing to note is that you should list the best affordable web hosting pricing for the unlimited plans; some companies may provide cheap hosting but limit the number of domains that you can host on their servers.

So we need to consider the unlimited plans.

So with our list above, let’s do the tabulation:

No. Company Plan Monthly Price Yearly price
1 Bluehost Plus $7.95 $95.40
2 Hawkhost Professional $7.99 $95.88
3 Hostgator Baby $8.36 $100.32
4 A2 hosting Shared $8.99 $107.88
5 1 and 1 hosting Unlimited Plus $9.99 $119.88

With the above tabulation, you can clearly see which hosting company you should consider. However, you need to take other things into consideration as seen below.

Tip # 3: Review the domain name pricing

If you are buying a domain name from the same company that is hosting your site, you need to create an additional column before you do the final conclusion. A company might offer cheap hosting services but fail to offer affordable domains.

In my opinion, don’t discredit a hosting company because their domain name is a little bit pricey. In some situations, it is advisable to buy a cheap domain name from a reputable company like Namecheap and still buy a hosting space with your reputable hosting provider.

Tip # 4: Review the hosting contract terms

Also, it’s good to note that some cheap domain and hosting companies will offer the hosting services at a discounted rate for the first year and then change their pricing after that.

If you like a 3 year contract like I do, you should always consider the pricing terms that each cheap web hosting services company offers. A three year plan may be cheaper when compared to a 1 year hosting plan.

Tip # 5: Consider coupon codes and discounts

It’s also a good idea to apply coupon codes whenever necessary to get great discounts before your final purchase.

I hope this guide will help you in choosing the best web hosting service providers. Remember, all of the companies I have mentioned above are the top cheap web hosting providers.

Hawkhost Review from a Verified Customer

Hawkhost is one of the most affordable web hosting companies. It is based in Ontario Canada. I have been using their services since 2013 when a friend recommended them to me and I am going to give a genuine Hawkhost review in this article. Apart from their shared hosting, they also offer Cpanel reseller hosting. In addition, if you are looking for full control on your server, they have affordable VPS (Virtual Private Servers) that you can customize to host your websites or online applications.

Hawkhost Technologies

  • Data Centers; Hawkhost utilizes around seven tier 3 and tier 4 data centres located in Dallas, TX, New York City, NY, Los Angeles CA, Amsterdam NL, Singapore SG, Hong Kong CN and Toronto. As one of their customers, you can choose the data center with the lowest latency during signup. Most cheap hosting companies do not have this feature so this is a plus to you.
  • Server Technology: Hawkhost runs their server using Cisco and Juniper network and this makes them extremely faster. In addition, they have UPS backups and diesel powered generators to ensure their servers are fully running even in extended periods of power blackouts.
  • Operating System: All Hawkhost’s servers all powered by the most affordable, secure and open source software – Linux which is known for its compatibility and flexibility. Linux is the most stable operating system that powers millions of sites today. It less susceptible to memory leaks, allows multitasking while still giving website owners the flexibility to install virtually any software. Linux outperforms Windows due to its incredible network performance.
  • Cpanel: Another notable feature I would like to point out in this Hawk host review is the Cpanel. All shared and Reseller accounts from this cheap hosting come with a free Cpanel license. You can use it to access File Manager, change PHP version, install databases and even administer your Mysql/Marida db’s using the PhpMyadmin. If you are running a CMS website powered by WordPress, Magento, Drupal or Joomla, Cpanel makes it easy to install the scripts and configure all the necessary files without using complicated command lines tools.
  • Server: Hawkhost uses the most powerful LightSpeed web server which is well known for performance and security. If you care more about your site, LightSpeed server comes with free Mod security and DDOS protection. In addition it is lightweight and compatible with most software applications eliminating the need to install third party layers. In fact, this is why Hawkhost has a very large customer base because their clients can enjoy accelerated web performance due to the cutting edge speed of LightSpeed web server which comes with double the speed of apache and can support thousands of con current users.
  • PHP/MySQL support: Hawkhost supports all PHP versions starting from 5.2 to the latest 7.2. Also, if you are a fan of MySQL and Maria databases, you will find them on Hawkhost fully configured with the latest security updates.
  • Magnetic Hard Disk Drives (HDD) are quickly becoming obsolete because they generate heat, are slow and even consume a lot of power. Hawkhost servers utilize SSD (Solid State Drives) which are around 100-200 times faster than HDD. While a 15,000 RPM hard disc accesses data within 2.0 to 4.1ms, the SSD utilized by Hawkhost can fetch the same data within 0.1ms. Sounds fast aren’t it?
  • Free SSL certificates. Hawkhost is an official Let’s Encrypt sponsor. This is an open source collaboration that offers free digitally signed SSL certificates. So, if you are planning to host a web store or an online shop Hawkhost is the best bet because you won’t spend extra cash on an SSL certificate. Let’s Encrypt SSL certificates will automatically renew so you don’t have to worry about tracking their expiries.

 Hawkhost Products

Hawkhost Domain Names

I will start with domains, although Hawkhost domain name price is not the lowest in the market, they give customers full access to their domains. They don’t lock your domains so you can easily change your name servers.

If you are hosting with them, that means you will be managing all your websites products in one control panel and therefore, you won’t forget to renew your products.

Hawkhost offers all top level domains including .com at an affordable price of $10.95 per year. You can also get ID protection at an affordable price on top of their 24/7/365 customer support.

Hawkhost Shared hosting

There are two affordable hosting plans offered by Hawkhost. The Primary Plan goes for around $2.99/month if you choose a 24 months billing cycle which is the best because it allows you to save a lot. With the plan, you are entitled for a 10GB SSD space, unlimited domains, unlimited bandwidth, unlimited email accounts and unlimited databases. You also get free migration support if you are moving from another provider. The Primary Plan is ideal for start-up websites e.g. personal wordpress blogs.

If you are running a lot of websites e.g. to cater for different niches, Hawkhost offers a Professional Package that starts from $7.99/month for a 24 months billing cycle. The Professional plan comes from unlimited storage on top of all the Primary plan features.

Also both plans are shell and SSH ready for those who like using Putty and command line tools. They also offer unlimited spam protected email accounts that you can access from your phone, browser or email clients like Ms Outlook.

Hawkhost SSD reseller hosting

Hawkhost has the best hosting Reseller Program. Their best reseller hosting packages come in three affordable plans. Bronze plan goes for $12.99/month while Silver and Platinum go for $25.99/month and $45.99/month. The choice of your Cpanel reseller hosting depends on the number of Cpanel accounts that you want to create, required space and WHMCs license.

Apart from the Bronze plan the other two cheap reseller hosting plans offer free WHMC license which you can use to manage your customers invoices and payments. However all of the Hawkhost’s linux reseller hosting plans come with WHM so it is easy to manage your customer accounts and resources without using third party tools.

If you buy reseller hosting, you can manage your customers and craft affordable plans for them and make some profit from the Hawkhost’s unlimited reseller hosting plans.

For instance, if you have 50 customers paying $50 per year that translates to $2,500 per year. With that amount, you can buy the Silver plan that goes for $25.99/month or around $312/year and pocket the rest of the money. This is ideal for web developers or designers with several customers.

Hawkhost VPS (Virtual Private Server)

Hawkhost is one of the best VPS sellers with affordable fully managed server products. Their semi-managed VPS start from $18/month with the most expensive going for around $58.50/month. Most website builders/owners go for the VPS route because they want to have more freedom with their servers. Hawkhost offers all those privileges to their customers via their rich VPS Cpanel. As a VPS owner, you can install, update, boot, reboot or even stop your VPS instance without using any complicated tools.

Hawkhost VPS gives you full root access and a choice of installing either CentOs, Debian, Fedora or Ubuntu Operating Systems. If you are planning to start a hosting business, CentOs is the best because it supports Cpanel and WHM.

As a VPS starter, Ubuntu will be a good bet because it is widely supported across the web and there are lots of learning resources from the internet. All of these VPS plans are hosted on Raid 10 SSD drives with 1gbit network ports to make them fast.

Other features

  • You can pay for Hawkhost services with a PayPal account or a Credit card. They always send a reminder for upcoming and overdue invoices. Also they offer a generous complementary one week grace period for all invoices in case you are strapped for cash.
  • 30 day Money back guarantee. If you feel you are not satisfied with the Hawkhost products, you can get your money back within 30 days. However, this guarantee does not apply to domain names.
  • Hawkhost coupon – they sometimes offer coupon codes that you can use to enjoy their hosting at a more affordable cost. The Hawkhost coupon applies to most of their plans apart from domain names.
  • 99% up-time guarantee. I have never seen any down time while using Hawkhost for around 5 years now and this is perfect if you don’t want to frustrate customers visiting your websites.
  • 24/7/365 support via email, phone, discussion forums or knowledge base. Once you send an email to Hawkhost, they create a ticket automatically. They will then keep updating the ticket until you are satisfied with your query. Their response time is very fast. I have sent dozens of tickets to them and they have always assisted me within a few minutes.

Hawkhost cons

Hawkhost does not offer script support. To put this into perspective, if you are creating a PHP script to calculate traffic data in your country, they can’t assist with that. But this is the same case with all hosting providers, although a hosting company can troubleshoot everything wrong with your account; don’t expect them to code scripts for you.


I hope I have covered everything about the Ontario based company in this Hawkhost Review. While choosing a cheap shared hosting can become somewhat complicated, this guide will enable you to make a proper decision to buy your hosting services from a renowned hosting provider with a proven track record. I stick to Hawkhost mostly because; they are polite and have used LightSpeed server on top of their super fast SSD driven servers and free Let’s encrypt certificates on all their plans. When it comes to monetization, they have the best WHM reseller hosting. Try Hawkhost today.

Varnish HTTP Cache Connection Refused on Apache & Ubuntu

If you get an error connection refused when trying to connect to your Apache web server with Varnish HTTP cache enabled ,consider doing the following steps:

Edit the ‘lib/systemd/system/varnish.service‘ file using a nano editor

$ sudo nano /lib/systemd/system/varnish.service

Change the default port 6081 to port 80 and then hit CTRL + X , Y and Enter to save the changes.

ExecStart=/usr/sbin/varnishd -j unix,user=vcache -F -a :80 -T localhost:6082 -f$

Then restart Apache, Systemd daemon and Varnish HTTP Cache using the commands below:

$ sudo systemctl restart apache2
$ sudo systemctl daemon-reload
$ sudo systemctl restart varnish

Varnish HTTP Cache should now work on your server without displaying the connection refused problem and your website should load really fast because frequented fetched information will be sourced from memory.