Raza Mehdi's Blog


How to create Virtual Hosts using Zend Server CE?

Hi guys!

I have been using Zend Server CE as my primary WAMP stack for quite a while, and i really love it. Creating virtual hosts in Zend Server CE is very easy and here is the method for:

  • Suppose the Zend Server installation directory is C:\Zend. Below i will refer to the install path as INSTALLDIR.
  • Open your httpd.conf file located at INSTALLDIR\Apache2\conf in a text editor, and edit the line
    #Include conf/extra/httpd-vhosts.conf


    Include conf/extra/httpd-vhosts.conf
  • Now goto the folder at C:\Windows\System32\drivers\etc and open the hosts file. If you havent yet set the permissions on this file, set it accordingly so that you can edit the file. Add the following lines: localhost myapp.localdev
  • Open your httpd-vhosts.conf file located at INSTALLDIR\Apache2\conf\extras in a text editor. Uncomment the line (if commented) NameVirtualHost *:80 and put down the following code …
    <VirtualHost *:80>
    DocumentRoot "C:/Zend/Apache2/htdocs"
    ServerName localhost
    <VirtualHost *:80>
    DocumentRoot "C:/Zend/Apache2/htdocs/myapp"
    ServerName myapp.localdev
    <directory "C:/Zend/Apache2/htdocs/myapp/">
    Options Indexes FollowSymLinks
    AllowOverride all
    Order Deny,Allow
    Deny from all
    Allow from
  • Now restart the apache webserver. Now, check the urls http://localhost/and http://myapp.localdev/. If no error occurs, then you have successfully configured Virtual Hosting in Zend Server…
Share and Enjoy:
  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • Eric_andrews1

    Thank you for the instructions. I followed them but get a “403 Forbidden” error when trying to acces http://localhost and http://joomla.local when I go to those urls. Any suggestions?

  • Anonymous

    Hi Eric,

    Thanks for your reply. Check your .htaccess file first and correct the relevant access permissions. Also check your apache httpd.conf file as well, just to be sure. Try restarting your system as well. This will probably fix the ’403 forbidden’ error as well.

  • N Molham

    that for the amazing tip cause I tried alot and finally it works, I have question, my fake domain is domain.dev, how can I make sub-domains like cat.domain.dev or even http://www.domain.dev

    I added in the vhosts file :

    DocumentRoot “C:/Program Files (x86)/Zend/Apache2/htdocs/domain”
    ServerName domain.dev
    ServerAlias *.domain.dev

    Options Indexes FollowSymLinks
    AllowOverride all
    Order Deny,Allow
    Deny from all
    Allow from

    and hosts file localhost domain.dev *.domain.dev

  • srmklive


    You just have to add any entries for the domain in the host file. Generally http://www.domain.dev should serve as an alias for domain.dev. Suppose you want to add test1.domain.dev & test2.domain.dev, just add them like this: test1.domain.dev test2.domain.dev

    Then define the respective virtual host definitions in the httpd-vhosts.conf file.

    Hope this helps you out.