µMax
µMax

Reputation: 347

creating virtual host in WAMP

I'm using Win7 and all my asp.net applications are running at port 80

I've WAMP installed at c:\wamp and i've my php project folder under c:\wamp\www\ as proj1,proj2 etc.,

Now i tried to create virtual host with below steps

1) edited 'hosts' file and added below

127.0.0.1:9091    testsite1.mymachine.com

2) Opened the file "httpd.conf" at "C:/wamp/bin/apache/Apache2.2.22/conf/" and uncommented the line "Include conf/extra/httpd-vhosts.conf".

3) Opened the file "httpd.vhosts.conf" at "C:/wamp/bin/apache/Apache2.2.22/conf/extra" and added the below

<Directory C:/wamp/www/proj1>
Order Deny,Allow   
Allow from all 
</Directory>

after the above code added the below

<VirtualHost *:9091>   
DocumentRoot "C:/wamp/www/proj1" 
ServerName testsite1.mymachine.com
</VirtualHost>

4) Saved all the above edited files from step 1 through step 3, restarted the wamp server services.

But, i'm unable to access my proj1 using "testsite1.mymachine.com". did i missed anything ? Also please take note by using "http://localhost:8081/" i'm able to see wampserver - server configuration page.

Many Thanks

Upvotes: 1

Views: 2081

Answers (1)

Saish Shinde
Saish Shinde

Reputation: 19

  1. goto F:\wamp\bin\apache\Apache2.2.21\conf and open httpd.conf file in text editor

  2. change line from #LoadModule vhost_alias_module modules/mod_vhost_alias.so to this LoadModule vhost_alias_module modules/mod_vhost_alias.so (uncomment)

  3. find following lines

    # Virtual hosts #Include conf/extra/httpd-vhosts.conf

    replace it with

    # Virtual hosts Include conf/extra/httpd-vhosts.conf

  4. now goto F:\wamp\bin\apache\Apache2.2.21\conf\extra and open httpd-vhosts.conf at the end add following code to httpd-vhosts.conf

    <VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot "C:/wamp/www/(project folder name)"
    ServerName (the name with which you want to deploy your project in the browser)
    ServerAlias (copy paste the ServerName)
    ErrorLog "logs/(deploy_name)-error.log"
    CustomLog "logs/(deploy_name)-access.log" common
      <Directory "/">
         Deny from all
         Allow from 127.0.0.1
      </Directory>
    </VirtualHost>
    
  5. finallly update the hosts file in windows system goto C:\Windows\System32\drivers\etc open hosts using notepad (open notepad as administrator).

    find line 127.0.0.1 localhost

    under it write 127.0.0.1 (copy paste the ServerName from "httpd-vhosts.conf")

  6. restart all the services from wamp.

  7. this should get the virtual host running, just type the server name in the addres bar of browser and hit enter.

Upvotes: 1

Related Questions