In
this tuts we are going to create a virtual host in wamp server. (As the title
said).
Let’s
get started!
Open
up and run your wamp server.
I’ve
already started my wamp.
Go
to "C:\wamp\www\". Create
a folder. Name it, "mysite"
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.)
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"
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>
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"
Go
to "C:\Windows\System32\drivers\etc"
Copy
paste this in "run" by pressing "window button" +
"r" for your convenience.
open
up the file name "hosts"
And
paste this text bellow.
127.0.0.7 mysites.com
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.
Or
you can type "127.0.0.7"
This
should be the output.
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
Post a Comment