Is this the best way to set up multiple domains on one server with Nginx or 
better to set up nginx "sites-available" etc configs?


On Saturday, March 23, 2013 at 3:01:38 AM UTC-7, peter wrote:
>
> Sorry about replying late Tito. I struggled with your problem for quite a 
> while, and here is a solution.
>
> In the web2py folder have a routes.py like this
>
> #!/usr/bin/python
> # -*- coding: utf-8 -*-
> routes_app=[
>                              ('.*://www.site1.com:\w* /$anything','app1'),
>     ('.*://site1.com:\w* /$anything','app1'),
>                              ('.*://www.site2.com:\w* /$anything','app2'),
>     ('.*://site2.com:\w* /$anything','app2')
> ]
>
> Then in the application folder for app1 have something like
>
> #!/usr/bin/python
> # -*- coding: utf-8 -*-
> routes_in = ((r'.*://site1.com:\w* /static/$anything', 
> r'/app1/static/$anything'),
> (r'.*://site1.com:\w* /$anything', r'/app1/default/$anything'),
> (r'.*://www.site1.com:\w* /static/$anything', r'/app1/static/$anything'),
> (r'.*://www.site1.com:\w* /$anything', r'/app1/default/$anything'),)
> routes_out = (('/app1/default/(?P<any>.*)', '/\g<any>'),)
>
>
> and similarly for app2
>
> I hope this helps
>
> Peter
>
>
> On Thursday, 21 March 2013 16:06:46 UTC, Massimo Di Pierro wrote:
>>
>> Yes you can. From the point of nginx treat all domains as one. the use 
>> web2py routes.py to map different domains to different apps.
>>
>> On Monday, 18 March 2013 15:21:25 UTC-5, Tito Garrido wrote:
>>>
>>> Hi Folks,
>>>
>>> I am reading the book section: 
>>> http://web2py.com/books/default/chapter/29/13#Nginx
>>>
>>> But I couldn't figure out how could I setup nginx to serve multiple 
>>> domains pointing to a different application on the same web2py instance.
>>>
>>> Do you have any example?
>>>
>>> like:
>>> mydomain1 -> /home/www-data/web2py/applications/myapp1
>>>
>>> mydomain2 -> /home/www-data/web2py/applications/myapp2
>>>
>>>
>>> Thanks,
>>>
>>> Tito
>>>
>>>
>>> -- 
>>>
>>> Linux User #387870
>>> .........____
>>> .... _/_õ|__|
>>> ..º[ .-.___.-._| . . . .
>>> .__( o)__( o).:_______ 
>>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to