apachezend-frameworkvirtualhostubuntu-11.04

Virtual host not working in zend framework


Following is my virtual host in /etc/apache2/sites-available:

<VirtualHost *:80>

DocumentRoot "/var/www/roomstays/public"

ServerName roomstays

#This should be omitted in the production environment
SetEnv APPLICATION_ENV development

<Directory "/var/www/roomstays/public">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>

</VirtualHost>

Also it enabled on /etc/apache2/sites-enabled folder

And following is my host file:

127.0.0.1   localhost
127.0.0.1   roomstays

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

I configured my site in var/www/roomstays. But when I entered roomstays on it not opening the site and showing this message :

It works!

This is the default web page for this server.

The web server software is running but no content has been added, yet.

What's wrong with virtual host.


Solution

  • Three things to check:

    1. Sites enabled

    Make sure your virtual host file is in /etc/apache2/sites-enabled.

    2. NameVirtualHost

    Make sure you have this somewhere in the apache config:

    NameVirtualHost *:80
    

    I have it in /etc/apache2/ports.conf (can't remember if thats the standard on Ubuntu)

    3. Remove default virtual host

    If none of the above works, you can rename your virtual host to something like /etc/apache2/sites-enabled/000000-myhost. This will ensure your virtual host file is loaded first. Alternatively remove /etc/apache2/sites-enabled/000-default

    Remember to restart apache after each change...