I’m a beginner in working with apache and in need of your help. My task is to build a dynamic webserver (Debian 6.0.4, Apache 2.2, one public IP) which can host multiple websites and files (like pictures, pdf etc.) for preview purposes.
Now my problem is that I need two different document roots. One for the websites and the other one for the files.
My attempt is to use mod-vhost-alias, so I don’t need a new entry in the httpd.conf for every virtual host.
My httpd.conf looks like this:
UseCanonicalName Off NameVirtualHost 192.168.10.45 <VirtualHost preview.example.com> Servername *. preview.example.com VirtualDocumentRoot /srv/www/%1/htdocs </VirtualHost> <VirtualHost websites. preview.example.com > Servername *.websites. preview.example.com VirtualDocumentRoot /srv/www/websites/%1/htdocs </VirtualHost>
The first vhost serves the files and works fine. The second one should provide directories containing website data. The websites underneath the subdomain “websites” are only reachable, if I deactivate the first virtual host.
What do I have to do, to make both of them work at the same time?
If this topic is already dealt with please give me a link.
Thanks for your time and effort.