Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
327 views
in Technique[技术] by (71.8m points)

php - How to setup virtual host using Wamp Server properly?

I need your help here in creating a virtual host in wampserver. In office I can create a virtual hosts but when I try to create in my laptop it doesn't work. I still can't figure out what's wrong. Here's what I did.

  1. I copy the wordpress file in this folder. This will be the path of my project

    • E:Subversionchelle.wpblog.local
  2. I edit the host file

    • C:WindowsSystem32driversetchosts
    • I added it to the end of file

      127.0.0.1 chelle.wpblog.local

  3. Next is I enable the virtual host in Apache

    • C:wampinapacheApache2.4.4confhttpd.conf
    • I uncomment this

      Include conf/extra/httpd-vhosts.conf

  4. Next is I setup the virtual host in WAMP

    • C:wampinapacheApache2.4.4confextrahttpd-vhosts.conf
    • I add this at the bottom

      <VirtualHost *:80>
          ServerName chelle.wpblog.local
          ServerAlias chelle.wpblog.local
          DocumentRoot "E:/Subversion/chelle.wpblog.local/"
          <Directory "E:/Subversion/chelle.wpblog.local/">
              Options Indexes FollowSymLinks MultiViews
              AllowOverride All
              Order allow,deny
              allow from all    
          </Directory>
      </VirtualHost>
      
  5. Last is restart wampserver and open the chelle.wpblog.local in the browser. And it doesn't display. It display only google search results.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I was installing the zend framework on my local wamp using apache server. First go and decide what will be your domain name for the local url. Ex->www.test_zend_tutorial.com then go and open the file located at "C:WINDOWSsystem32driversetc"

hosts

write

127.0.0.1 (use one tab space) www.test_zend_tutorial.com

then go to the folder located at

D:wampinapacheApache2.2.17 (whatever is your version) conf

and open the file

httpd.conf

and search for text

Include conf/extra/httpd-vhosts.conf

and uncomment it by removing the # tag from the start of the line.Save the file and close it. Now go to another folder located at

D:wampinapacheApache2.2.17confextra

and open the file

httpd-vhosts.conf

and paste the code below at the last in this file

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    DocumentRoot "D:wampwww"
    ServerName localhost
    ErrorLog "logs/localhost-error.log"
    CustomLog "logs/localhost-access.log" common
</VirtualHost>

<VirtualHost *:80>
   ServerName www.test_zend_tutorial.com
   DocumentRoot "D:wampwww(your project folder name)public"
    SetEnv APPLICATION_ENV "development"
    <directory "D:wampwww(your project folder name)public">
        DirectoryIndex index.php
        AllowOverride all
        Order Allow,Deny
        Allow from all
    </directory>
</VirtualHost>

and restart the wamp, now write the www.test_zend_tutorial.com in the browser and you will see the things working.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...