Lee Web Hosting – Hosting Providers Agency Host Multiple Domains (Virtual Host) in your Apache HTTP Server XAMPP

Host Multiple Domains (Virtual Host) in your Apache HTTP Server XAMPP

Host Multiple Domains (Virtual Host) in your Apache HTTP Server XAMPP post thumbnail image

multiple realms or your single Apache server instance in my occurrence i’m gonna be using xampp which is a crossplatform development environment that contains apache my sequel PHP and pro this process shall be guided by similarly for other development environment such as lamp for linux man for Mac OS 10 and one for Windows in this case like I said I’m gonna employing xampp and as you can see here I have the exact control panel now if you have an exam I’m gonna include the link down in the description but you could also go to Apache French Arabic and download xampp from there and in exam you can use it for Windows Mac OS 10 or Linux so is moving forward and download if you don’t have it already now once you’ve downloaded it you have to go to the root of the direction of the installation in such cases I have a setting my D Drive and here is the root so what the hell is you want to go next is to the Apache folder and then to the config folder and finally go to the extra folder now in this folder the register were interested in is the HTTP D free host that config datum and I’m gonna open this up with Adam which is my editor of pick but you can open it with notepad plus plus or any other type of editor time a text file and here it is so what we’re gonna do now it’s create two virtual legions guidings and those are going to catch the two disciplines that we’re going to host in this example and those are going to be example.com and sandbox comm so once you open this file you’ll get a pretty good example of what a big host should look like so I’m just gonna copy this and paste it down here and then these hash marks are notes in the config folders so you want to remove those all of those and we’re gonna modify to fit our needs so firstly like I said we’re going to host example.com so the server I mean we’re gonna supersede that and just make sure it’s just example.com and the the document root we’re going to move that from exam the Coulomb force plus XM to we’re gonna create a folder for berth actually let’s just make it easier virtual and then example.com and the server call is going to be example that I come again and we’re just going to update the fields us we as the work requires so precisely make sure the log files have the chastise mention I’m gonna modernize that now in addition to what what the sample presents on the top we’re likewise going to use the directory directory directive so so that we can modify the default values of it that are in the other Apache configuration files so we’re going to do a selfcontained directory if directive here and now we’re going to do the panel which is in this case my D Drive eggs app and then virtual and example.com just gonna close that so the first thing we’re going to do is we’re going to do the options then in the indicators and you can look up more information about this in the Apache diver website and but mostly the next way permit override and make sure you have make sure that you follow the claim spelling and syntax otherwise you can get an error when you start your server and compel granted okay okay so mostly what this is gonna do is this is gonna show the when are you reaching at the freedom plow that does not have an index file it’s gonna index all the files that are in there if it does have an index file then he will show that index file if not we’ll simply present the folder in there this one the grant right or what allow us to modify the directives in in a htaccess datum so this is pretty beneficial when you got like something like WordPress so you wanna have it you have an MVC a formulate or anything in there that you want to breathe direct all the requests to a single file so that’s what we’re gonna have to allow alright all guiding in there and now we’re gonna basically simply facsimile this I’m just gonna reproduce it over and only update all the references from example.com to sandbox comm so I’m just gonna copy this and paste all the references of example that come in this virtual multitude directive inside of it and merely update it save it and make sure you save the file I only click on try to it ctrl s to save it but make sure you save it and now just go to your Apache control panel and merely sound start Apache exactly started right now so you can see it’s running on port 80 by default and pour 443 but we’re just gonna use port 80 now and let’s go back to a browser and just go to example.com so you can see that’s what we get that’s not our thing and let’s go to sandbox com okay so this makes you to these places now the thing that that urge is is we have it all right over learning the emcees enters in Windows so we’re not mapping these two lands to our actual domain so in this case like I said this is just for development purposes and we’re gonna do it locally on our machine so the moment of this is to allow you to actually test it on the real disciplines on the real disciplines on your machine without actually having to FTP them to the actual server that’s hosting that domain so we’re gonna kind of forge the actual DNS in here and we’re gonna go to the host documents in your machine the track is windows on your c drive windows plan 32 drivers et Cie and then what the folder you’re looking for is the host file now this record you might need to open it as an administrator in order to be able to alright the default values of it but what this file does if you’re not familiar with it it’s mostly it Maps a domain name to an IP address so we’re going to planned example.com and sandbox comm to 127 that 0 that’s your that one which is a robot IP and if we do that and it’s just do it for sandbox comm now I have saved the record I opened it with as an administrator so I don’t see any inspires when saving it if you realise a problem when you’re saving the enter time make sure you open it as an administrator once again so now we’ve done that let’s go back to example.com refresh this and we get access forbidden which is that’s pretty good and let’s go back to HTTP and then sandbox and then we should get the same thing access for being another reason for that is that we haven’t made those directories more and as you can see if you click on’ contact Webmaster you can see a forward at the bottom left where what it contains the webmasters email that we are only caused on the virtual legion so that’s pretty cool that you get all that information in there and there you can see that sandbox calm air for 3 so now let’s dis cook that let’s go back to the actual sample directory create a new folder a brand-new folder and let’s call it virtual there you go now it’s going to that folder and form two brand-new folders one called example.com and the other one call center so now if we refresh you see it’s indexing the documents that’s the options indicators this is file directly there that it’s causing this to happen but there’s no registers in there so we’re not gonna have to create on some registers so that we can actually see what’s going on so I’m going to open this director perturb this directory here with Adam and I’m just gonna create a new document index.php yes it’s just create a very simple PHP script that time calls the PHP info function and I’m just going to copy all this and to another register in sandbox calm and exactly target that and save it let’s just refresh the site and refresh the site so you can see here if you go down you have the HTTP host environment variable and it’s actually sandbox calm and if you go down here to substantiate spring it’s actually the same document genuinely that job we just created and let’s go back to example that farm so the same thing you can see it that this is the document root and this is actually a server appoint so we’ve cause it up accurately so that our arrangement interprets the sample tranquilize lend domain name and redirects it to or local IP address 127 fleck 0 0 1 and we’ve done that so now let’s it’s actually go to the enters unless you to something else so this is some the sandbox background so welcome to sandbox calm and in instance calm we’re just gonna do something different like eco hello and it’s gonna save that and let’s refresh the site and I realise what we get we get that and then we get this so as you can see here you can do it on your local machine you can do you can do this so you could be development for different realms without actually having to deploy those to those folders to an FTP server and if you have an an actual Apache server in your in your actual server like if you have an aversion machines loping somewhere that’s where you host your your subjects and you require you want to do this you could also do this if you don’t have an easy wizard practice where you can access that so if you actually modify the virtual host folder you can actually do this anywhere that it’s running an Apache server and so that’s it for this tutorial thank you guys for watching and then don’t forget to subscribe to the channel then you know phantom and if you liked this video make sure to smack that like button and share with your best friend and and other people that might find is useful

pexels photo 5926381 - Host Multiple Domains (Virtual Host) in your Apache HTTP Server XAMPP

Leave a Reply

Your email address will not be published.

Related Post