Step 4 − Once the options are selected as shown in the following screenshot, click on Next. We can leave it as default and click on “Next”. Step 3 − You have the option asking where to install the application. Step 2 − Once the option is selected, click on “Next”. In our case, it will be the first one (Windows host). Step 1 − To download VirtualBox, click on the following link Now, depending on your OS, select which version to install. We should follow the steps given below for the installation. To start with, we will download VirtualBox and install it. Here we discuss the concept, working, step to create with illustration and Example.In this chapter, we will understand what a VirtualBox is and discuss in detail the various components it has. This has been a guide to What is a Virtual Host. In this article, we started with the basics of virtual host and then we saw different ways through which hosts are configured.įinally, we also had a practical demo of how we can set up it using Apache as our web server and Linux as our OS. Open up a web browser and fire up the domain name of your websites one by one, and you should see pages like below: Sudo service apache2 restart Step 6: Test your Results Once it is done, please restart our apache server: We have newly set up our virtual files, and now we need to enable them. ServerAlias Finally, please change the location of the document root of our domain.ĭocumentRoot /var/Similarly, please follow the above procedures for our second domain as well. The next thing is to add 2 directives: ServerName (This should be your domain) and ServerAlias. Here we need to change the email to replace it with the email of the server admin. When this is done, please open it with your favourite editor.ĬustomLog $/access.log combined Sudo cp /etc/apache2/sites-available/nf /etc/apache2/sitesavailable/nf Let us first copy that apache conf file to our first domain: As we have already installed Apache, it comes with a default virtual host file which is known as nf, and we will be making use of it. These are the files that are having the actual configuration of our hosts. ![]() Step 4: To \Ccreate the New Files for Virtual Host Success! The test2 virtual host is working! Similarly, we can create the HTML page for the other website, i.e. Success! The test1 virtual host is working! Vi /var/Once it is open, please write some basic HTML code, save the editor and close it. Open it with a vi editor or any editor of your choice and do some HTML things! Let us first create the sample/test page for. Sudo chown -R $USER:$ YOUR_USER_NAME /var/www/ /public_html Step 3: Create Sample (Demo) Pages for Each of the Virtual Hosts Sudo chown -R $USER:$YOUR_USER_NAME /var/www/ /public_html Sudo mkdir -p /var/So if you want to change it in order to modify the files in the web directories, we can do it by following: So we are going to make the directories structure as follows under our document root ( /var/www directory) The first step is to create a directory structure used to store the site data that we will be serving to site visitors, or we will accept data from visitors. If Apache is not installed, please install it with the help of the following commands:Īs for our tutorial, we will be creating the virtual host for domains: It would help if you had an Ubuntu OS with you and an Apache installation. One reason for selecting Apache is that it is one of the most trusted and reliable servers used to set up Iy. How to Create a Virtual Host/ Examples and Illustration?įor the purpose of our illustration, we will be using the Apache server to set up the Apache hosts over the Ubuntu Operating System. ![]() ![]() When the domain name is provided, the server checks the host configuration and thereby returns the request with the correct website. When the browser is trying to connect to the server, it will send a message to the server informing about the domain name to which it is trying to connect. The name-based Virtual host will use the single IP address for all the domains on the given server. Name-based virtual hosts are the most commonly and frequently used virtual hosting technique that is used today.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |