Ubuntu 20.04 installed? How to have multiple sites on an Apache server?

Apache is the most widely used web server worldwide. Flexibility, documentation and a huge community are some of the strengths that make Apache different from the competition.

After we have already transformed our Ubuntu into a LAMP and installed the Webmin, we will learn how to have multiple sites on a single server.

Ubuntu 20.04 installed?  How to have multiple sites on a server?

What is Webmin?

Webmin is a graphical administration tool (web-based), written by Jamie Cameron, that allows us to easily manage our Linux / Unix system. In this way, through a simple browser, we can control / manage the “powerful engine” of our Linux / Unix from anywhere in the world – find out more on here.

How to have multiple sites on Apache using Virtual Hosts?

There are several configurations that allow you to have several sites available on a single Web server. The simplest way is to create Virtual Hosts. The creation of Virtual Hosts allows that, in a single machine, we can have several sites, each one of which can be associated with a name or an IP address.

Apache supports two types of VHs (Virtual Hosts)

  • Name-based VHs: that is, in a single IP address it is possible to have an unlimited number of VHs, with Apache distinguishing them by name;
  • VHs based on IP address: it is necessary that for each VHs there is an IP address, and Apache distinguishes the VHs by the IP address of the connection;

For this tutorial we will consider the following information / settings:

  • Site name1– wiki.pplware.com
    • Hosted at / var / www / html / wiki
  • Site name2– icat.pplware.com
    • Hosted at / var / www / html / icat
  • Site name3– ishark.pplware.com
    • Hosted at / var / www / html / ishark
READ MORE  Ubuntu in the style of macOS? Install the new Touchégg 2.0.0

To create a Virtual Hosts you must select Servers > Apache WebServer

Ubuntu 20.04 installed?  How to have multiple sites on a server?

Next we go to Create virtual host and then we must fill in at least the fields Document Root and Server Name.

Ubuntu 20.04 installed?  How to have multiple sites on a server?

Explanation of the most important directives:

  • DocumentRoot – Indication of the folder where the site is located
  • ServerName – Name associated with the site

Finally just press the button Create Now. Once created, you can see the global configuration and the configured Virtual Host.

Those who do not have a DNS server available to configure and create a record of the VH created, can easily put the information in the file / etc / hosts to test in a local environment. To do this, just go to Networking> Network Configuration> Hostname and DNS Client

And create the necessary records by clicking Add a new host address

As a challenge (again) try to create the two remaining sites (icat and idog) and activate them in apache, just as you did with the previous one. Don’t forget to restart the apache service in the upper right corner. Here is an image with icat.pplware.com working.

We hope this article is useful and hope to bring you new tips soon. If anyone has suggestions, don’t forget to leave them in the comments.

Read also …


Search Millions Of Tech Jobs Now Free


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.