You can handle this at the web2py level with a single catch-all
virtualhsost.

create a web2py/routes.py that contains:

routes_in=(
    ('/robots.txt','/welcome/static/robots.txt'),
    ('/admin$anything','/admin$anything'),

    ('.*:https?://(www.)?domain1.com:$method /','/app1/default/
index'),
    ('.*:https?://(www.)?domain1.com:$method /$app/$anything','/
app1/$anything'),


    ('.*:https?://(www.)?domain2.com:$method /','/app2/default/
index'),
    ('.*:https?://(www.)?domain2.com:$method /$app/$anything','/
app2/$anything'),

    ('.*:https?://(www.)?domain3.com:$method /','/app3/default/
index'),
    ('.*:https?://(www.)?domain3.com:$method /$app/$anything','/
app3/$anything'),
)


On Oct 17, 5:21 pm, Tom Atkins <[email protected]> wrote:
> I know this has been asked before but I've been unable to find a clear
> answer. (Apologies to Graham Dumpleton who must have answered this kind of
> question many times for Django etc but I can't work out how to do it for
> web2py)
>
> I have a Debian server set up and running web2py with mod_wsgi using the
> instructions in the book.  All works great.
>
> The file /etc/apache2/sites-available/default has the virtualhost directives
> as shown in the book. So at the moment any request to the server simply
> shows the welcome app.
>
> I have 3 domain names which resolve to the IP address of the server:
>
> - domain1.com
> - domain2.com
> - domain3.com
>
> I have a web2py application for each of these.  They are in
> /var/www/web2py/applications/domain1 etc.
>
> So now I want to create 3 files in /etc/apache2/sites-available that will
> get apache to serve up the appropriate application for each domain.
>
> The key is that it should not require another instance of web2py for each
> application.
>
> Can someone suggest how the virtualhost files should look please?  Many
> thanks in advance.

Reply via email to