Skip to main content

How to create a virtual host in Wamp Server 2



In this tuts we are going to create a virtual host in wamp server. (As the title said).
Let’s get started!

Step 1:
Open up and run your wamp server.
I’ve already started my wamp.

Step 2:
Go to "C:\wamp\www\". Create a folder. Name it, "mysite"


Step 3:
Go to "C:\wamp\bin\apache\apache2.2.22\conf"
And create a folder. We will name it "mysites"
(By the way, just access "C:\wamp\bin\apache\" because the number will change over time. Because it’s a version number of apache.)





Step 4:
We will create a conf file; named "mysite1.conf" conf is a file extension

NOTE: you can give a folder/conf-file name whatever you want. But for this purposes I will name it "mysite"





Step 5:
Copy paste this text bellow in "mysites.conf" file.
<VirtualHost 127.0.0.7>
                        DocumentRoot "c:/wamp/www/mysite"
                        ServerName mysites.com
            <Directory "c:/wamp/www/mysite">
                        Options Indexes FollowSymLinks MultiViews
                        AllowOverride all
            </Directory>
</VirtualHost>

Step 6:
Go to "c:\wamp\bin\apache\apache2.2.22\conf\" open up the file name "httpd.conf".
And search this "# Virtual hosts" text/word.
Paste the directory link of your "mysite.conf" file.
"Include conf/mysites/mysite.conf"



Step 7:
Go to "C:\Windows\System32\drivers\etc"
Copy paste this in "run" by pressing "window button" + "r" for your convenience.

Step 8:
open up the file name "hosts"
And paste this text bellow.
127.0.0.7                                             mysites.com



Step 9:
Finally, restart your wamp server to take effect.
NOTE: If the wamp icon server doesn’t turn into green and stays in yellow, there might be some typography error in setting up your virtual hosts. Go back and see the errors. It might be in these files -> hosts, httpd.conf. or mysites.conf.

Go to your web browser and type "mysites.com"
Or you can type "127.0.0.7"

This should be the output.


Conclusion and Notes:
In this tuts I’ve share to you how you can create a virtual host in wamp server, you can also apply this in xampp. I’ve share this tuts due to the fact that some web application such as wordpress are not portable.

It means that if you create a web site with wordpress installed or under a URL named "http://localhost/worpdress" or "http://localhost/mysites" and try to upload it in your webhost named "http://mysite.com" you will end up some errors the content that you've uploaded will not be display. Because "http://localhost/worpdress" is saved in the database (default) and changing it in the database is hassle.
Thus creating a virtual host is a good advice.
Before we end up here, if you access your "http://mysite.com" be sure to disable the "127.0.0.7 mysites.com" in hosts file ("C:\Windows\System32\drivers\etc\hosts") just by add sharp or hash "#" beside the ip-addres "#127.0.0.7 mysites.com" if you don’t, you can’t access your website.










Comments

Popular posts from this blog

How to include php.exe directory path in system variables path

Hi guys, Have you tried this command? I was really frustrated when I have to call php cli (the red line) with its directory. As you can see in the image above, I’m accessing the fuelphp’s command line utility named “oil”. In my case, my folders and directories are arranged well and thus, additional folders needed to cluster them all (somewhat like a library) like the image bellow. So that means I have to access php cli and fuelphp in this a long line of text: C:\> cd c:\wamp\bin\php\php5.3.13\ C:\wamp\bin\php\php5.3.13>php c:\wamp\www\PATH_1\ PATH_2\ PATH_3\ PATH_4\ PATH_5\fuelphp\oil To address this problem, samsami2u shares his knowledge. Here’s how Step 1 Go to your “Computer Icon” and right-click. Press “Properties”   Step 2   On the “Control Panel Home” click “Advanced System Settings” Step 3   A “System Properties” window will pop-up. It will a automatically select the “Advanced” Tab. The...

How to create and merge a twin photo of yourself in Gimp.

How to create and merge a twin photo of yourself in Gimp. By Benjie Dagunan
Hello! this will be my first post. as you can see, there's nothing yet to be read. but sooner or later i will be posting some of my works. but for now i will just leave with this web design. A simple mock-ups created inkscape