Apache is an web server where by it stores information about a website. Originally one web server would store one website. The server would be known as the host. As time progressed, more and more people had websites and it got to a point where by we would need more servers per website. Eventually an virtual host was developed. Through the use of virtual host, you can have multiple websites sitting on the singe server.
Here is an example of an virtual host where by 2 websites are on the same server and how they are able to show different content.
/etc/apache2/sites-available/000-default.conf <VirtualHost *:80> ServerName mysuperweb.co.uk ServerAlias www.mysuperweb.co.uk DocumentRoot /var/www/mysuperweb </VirtualHost> <VirtualHost *:80> ServerName second-website.co.uk ServerAlias www.second-website.co.uk DocumentRoot /var/www/second-website </VirtualHost>
The first website is mysuperweb.co.uk, this website content is loaded from /var/www/html/mysuperweb. This will show the contents for this website. For the website called “second-website.co.uk” the content will be loaded from the location of /var/www/html/second-website.
Through this method, our server is able to determine the difference between the two websites when someone visits the domain names and it will show the corresponding content. There isn’t an limit to the number of websites apache can handle. You would be limited by the servers capabilities and more likely to be limited by the CPU or RAM consumption. The hard disk would be another factor as well, if the website contains large volumes of data.
This concept is very similar to how other web control panels work such as cPanel and Plesk, via this method an single powerful server can serve may websites and effectively allowing an shared hosting platform to exist.