Apache vhost config – why doesn’t this work

apache-2.2

I have an ubuntu with the the following config file:

<VirtualHost *:80>
    ServerName dev.domain.com
    DocumentRoot /data/sites/dev.domain.com/www/public
</VirtualHost>

Other vhost files are being served correctly on this host. It is properly symlinked; the directory exists. Is there a reason why this is not working? I don't see anything in the standard apache server logs.

thx

edit:
this is an ubuntu host and many other vhosts using the standard sites-available / sites-enabled are working. One issue is that it runs both mod_php and phusion mod_rails.

@Lain here's the output from a2ensite:
jon@ve:/etc/apache2/sites-available$ sudo sudo a2ensite /etc/apache2/apache2.conf
ERROR: No site found matching /etc/apache2/apache2.conf!

here's the output from apache2ctl -S (thx for this – I had always wondered how to to do this)

 jon@ve:/etc/apache2/sites-available$ /usr/sbin/apache2ctl -S
 VirtualHost configuration:
 wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
         default server ve.vesrv.com (/etc/apache2/sites-enabled/000-default:1)
         port 80 namevhost ve.vesrv.com (/etc/apache2/sites-enabled/000-default:1)
         port 80 namevhost testfb.hex.com (/etc/apache2/sites-enabled/001-testfb:1)
         port 80 namevhost testfb2.hex.com (/etc/apache2/sites-enabled/002-testfb2:1)
    ....
         port 80 namevhost rails-dev.rtm.com (/etc/apache2/sites-enabled/018-rails-dev.rtm.com:1)
         port 80 namevhost dev.domain.com (/etc/apache2/sites-enabled/019-dev.domain.com:6)
Syntax OK
jon@ve:/etc/apache2/sites-available$

Best Answer

Add to the file, between <VirtualHost>...</VirtualHost>:

<Directory /data/sites/dev.domain.com/www/public>
    Order allow,deny
    allow from all
</Directory>

Make sure you have NameVirtualHost *:80 somewhere before this file is loaded. (You can stick it just before <VirtualHost *:80> to be sure.)

EDIT 2: Make sure you sudo a2ensite config_file config_file is the file that contains the <VirtualHost> block. Should be /etc/apache2/sites-available/dev.domain.com.conf and you should use sudo a2ensite dev.domain.com.conf

Make sure you sudo apahce2ctl restart

EDIT:

Regarding logs, not sure what your global conf is. You may need this within <VirtualHost>...</VirtualHost>:

    ErrorLog /var/log/apache2/dev.domain.com-error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/log/apache2/dev.domain.com-access.log combined
Related Topic