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 turned our Ubuntu into a LAMP and installed Webmin, we will learn how to have multiple sites on a single 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 will be able to control / manage the “powerful engine” of our Linux / Unix from anywhere in the world – find out more 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 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
To create a Virtual Hosts you must select Servers> Apache WebServer
Then we go to Create virtual host and then we must fill in at least the Document Root and Server Name fields.
Explanation of the most important directives:
- DocumentRoot – Indication of the folder where the site is located
- ServerName – Name associated with the site
Finally just click on the Create Now button. Once created you can see the global configuration and the configured Virtual Host.
Anyone who does not have a DNS server available to configure and create a record of the VH created, can easily put the information in the / etc / hosts file 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 they 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 will be of use and hope to bring you new tips soon. If anyone has suggestions, don’t forget to leave them in the comments.