wamp

24 Oct

How to install wamp server and config virtual host

By Huỳnh Kiên Trung

How to install wamp server ? How to config virtual host on your local?

1. Install wamp server:

  • Step 1:
  • After download complete, go to step 2
  • Step 2:
  • - Open file install wamp server from your download location and install it
  • - Choose your location you want to store wamp server ( I think keep default setting :D )

  • - Click next and next to continue and finish to complete install. ( should keep all default setting )
  • Step 3:
  • - When finish install, you’ll see icon of wamp on your taskbar like below image

  • - You can open wamp from Start -> All program -> Wamp Server -> start wamp server
  • - To test install working correctly, open your browser and type http://localhost/, if you see home page of wamp server, you installed success, else: return to step 1 :D Config virtual host
  • Step 1:
  • - Right click to icon wamp server on your taskbar, choose Apache -> click httpd.conf

  • - Enable mod rewrite and mod vhost
    #LoadModule rewrite_module modules/mod_rewrite.so
    replace to
    LoadModule rewrite_module modules/mod_rewrite.so
  • - Find
    #LoadModule vhost_alias_module modules/mod_vhost_alias.so
    replace to
    LoadModule vhost_alias_module modules/mod_vhost_alias.so
  • - Find
    #Include conf/extra/httpd-userdir.conf
    replace t
    Include conf/extra/httpd-userdir.conf
  • - Find
    #Include conf/extra/httpd-vhosts.conf
    replace t
    Include conf/extra/httpd-vhosts.conf
  • - Save all change
  • Step 2: Config path of virtual host
  • - Open folder store conf in <wamp location>\bin\apache\Apache2.2.11\conf\extra ( ex: C:\wamp\bin\apache\Apache2.2.11\conf\extra )
  • - Open file httpd-userdir.conf ( store website location )
  • - Add all line below to end of file
    <Directory "C:/Documents and Settings/*/My Documents/My Website">
    AllowOverride FileInfo AuthConfig Limit Indexes
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    <Limit GET POST OPTIONS>
    Order allow,deny
    Allow from all
    </Limit>
    <LimitExcept GET POST OPTIONS>
    Order deny,allow
    Deny from all
    </LimitExcept>
    </Directory>
  • Change
  • <Directory "C:/Documents and Settings/*/My Documents/My Website"> to <Directory "your website location">
  • Ex: <Directory "D:\Trung\MyProjects\silverstripe">, if you have many website in folder MyProjects like me, you can config Directory is D:\Trung\MyProjects, it’ll apply config for all sub folders of MyProjects
  • Step 3:
  • - Open file httpd-vhosts.conf ( config name of virtual host )
  • - Ctrl+ A and remove all content
  • - Add this content to config your localhost
  • NameVirtualHost *:80
  • <VirtualHost *:80>
  • ServerAdmin webmaster@dummy-host.localhost
  • DocumentRoot "C:\wamp\www"
  • ServerName localhost
  • </VirtualHost>
  • -  If you not install wamp on C, you must change DocumentRoot to <your wamp>\www
  • - Next, to config your new local URL, just copy all lines from <VirtualHost >….</VirtualHost >
  • - Change DocumentRoot to your website location ( ex: DocumentRoot "D:\Trung\MyProjects\silverstripe" )
  • - Change ServerName to your website name ( ex:  ServerName silverstripe.dev)
  • Step 4:
  • - Open window host file ( can find in C:\Windows\System32\drivers\etc )
  • - Add your website name like this ( 127.0.0.1    silverstripe.dev )
  • - Right click icon wamp server on taskbar and click restart
  • - When wamp server done, you can open browser and run your website with new domain

I hope this tutorial can help you install wamp server and config virtual host success :D