[web2py] Re: How to serve multiple domains and multiple applications on nginx using pattern-based route

2013-10-09 Thread Gour
On Fri, 4 Oct 2013 19:32:36 -0700 (PDT)
IVINH toa...@gmail.com wrote:

 Nginx config:

In my case Nginx is setup as reverse-proxy and it dispatches reuqests to
gunicorn listening on local port.

 routes_in = ((
 (('.*http://demo.ivinh.com.* /*', '/demo')),
 (('.*http://demo1.ivinh.com.* /*', '/demo1'))
 ))

Would you recommend same setup, iow. using one web2py instance  if I
e.g. need to serve 3 indepdendant web sites each at different TLD, like:

http://www.domain1.com/

http://www.domain2.com/

http://www.domain3.com/

or there is some more suitable setup in such use case?


Sincerely,
Gour

-- 
A person is said to be elevated in yoga when, having renounced 
all material desires, he neither acts for sense gratification 
nor engages in fruitive activities.

http://www.atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: How to serve multiple domains and multiple applications on nginx using pattern-based route

2013-10-09 Thread Gour
On Wed, 9 Oct 2013 09:51:35 +0200
Khalil KHAMLICHI
khamlichi.kha...@gmail.com wrote:

 supposing you have the correct dns settings for those domaines, you
 only need to modify the routes.py file located inside web2py
 directory .

I did not find any existing routes.py file?

 here is a working file example (I am using it)
 
 # -*- coding: utf-8 -*-
 
 routers = dict(
 BASE = dict(
 domains = {
 'www.example1.com': 'app1',
 'www.example2.com': 'app2',
 }
 ),
 )

With the above one I always get the default 'welcome' app, although set
my domains to map to cloned apps.

I've:

routers = dict(
BASE = dict(
domains = {
'domain1.com': 'welcome',
'domain2.com': 'clone2',
'domain3.com': 'clone3',
}
),
)

If I visit: www.domain2.com/clone2 I get access to 'clone2' app.

Probably I do miss something..will do some more reading...

 hope this helps.

Yes. Is the above-like setup also recommended in the practice?

I'm asking 'cause it really makes deploying web2py-powered sites (aka
apps) breeze in comparison with the fiddling required for django sites.


Sincerely,
Gour

-- 
One who restrains the senses of action but whose mind dwells on 
sense objects certainly deludes himself and is called a pretender.

http://www.atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: How to serve multiple domains and multiple applications on nginx using pattern-based route

2013-10-09 Thread Gour
On Wed, 9 Oct 2013 09:51:35 +0200
Khalil KHAMLICHI
khamlichi.kha...@gmail.com wrote:

 hope this helps.

Ahh...forgot to restart gunicorn. :-(

All is well now or web2py rocks. ;)


Sincerely,
Gour

-- 
As the embodied soul continuously passes, in this body, 
from boyhood to youth to old age, the soul similarly passes 
into another body at death. A sober person is not bewildered 
by such a change.

http://www.atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: How to serve multiple domains and multiple applications on nginx using pattern-based route

2013-10-08 Thread IVINH
It work with web2py 2.6.4. Pls review your routes file.

Vào 23:36:13 UTC+7 Thứ hai, ngày 07 tháng mười năm 2013, Tito Garrido đã 
viết:

 This route didn't work for me...
 routes_in = ((
 (('.*http://demo.ivinh.com.* /*', '/demo')),
  (('.*http://demo1.ivinh.com.* /*', '/demo1'))
 ))

 Not sure it is because I am using uwsgi... it keeps going to the default 
 website...




 On Sat, Oct 5, 2013 at 4:30 PM, Tito Garrido titog...@gmail.comjavascript:
  wrote:

 Thanks!!! I will try!


 On Fri, Oct 4, 2013 at 11:32 PM, IVINH toa...@gmail.com javascript:wrote:


 Nginx config:


 server {
  listen 80; 
 server_name demo.ivinh.com www.demo.ivinh.com;
  include deny_admin.txt;
 access_log logs/demo.ivinh.com.access.log;
  error_log logs/demo.ivinh.com.error.log;
 location / { 
 proxy_pass http://127.0.0.1:86;
  proxy_set_header Host demo.ivinh.com;
 include proxy.conf;
  }}
  server {
 listen 80; 
  server_name demo1.ivinh.com www.demo1.ivinh.com;
  include deny_admin.txt;
 access_log logs/demo1.ivinh.com.access.log;
  error_log logs/demo1.ivinh.com.error.log;
 location / { 
 proxy_pass http://127.0.0.1:86;
  proxy_set_header Host demo1.ivinh.com;
 include proxy.conf;
  }}


 Web2py routes.py run at 127.0.0.1 port 86:


 routes_in = ((
 (('.*http://demo.ivinh.com.* /*', '/demo')),
  (('.*http://demo1.ivinh.com.* /*', '/demo1'))
 ))





 Vào 06:43:07 UTC+7 Thứ bảy, ngày 05 tháng mười năm 2013, Tito Garrido đã 
 viết:

 Hi Folks,

 I am using the default setup from the book for nginx: 

 scripts/setup-web2py-nginx-**uwsgi-ubuntu.sh

 And my routes are using *pattern-based* system.

 The question is, how can I route www.domain1.com to app1 and 
 www.domain2.com to app2?

 nginx config in sites-enabled:

 *server {
 listen  80;
 server_name $hostname;
 ###to enable correct use of response.static_version
 location ~* ^/(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ {
 alias /home/www-data/web2py/applications/$1/static/$2;
 expires max;
 }
 ###

 ###if you use something like myapp = dict(languages=[en, it, 
 jp], default_language=en) in your routes.py
 #location ~* ^/(\w+)/(en|it|jp)/static/(.*)$ {
 #alias /home/www-data/web2py/applications/$1/;
 #try_files static/$2/$3 static/$3 =404;
 #}
 ###
 location ~* ^/(\w+)/static/ {
 root /home/www-data/web2py/applications/;
 #remove next comment on production
 expires max;
 ### if you want to use pre-gzipped static files 
 (recommended)
 ### check scripts/zip_static_files.py and remove the 
 comments
 include /etc/nginx/conf.d/web2py/gzip_static.conf;
 ###
 }
 location / {
 #uwsgi_pass  127.0.0.1:9001;
 uwsgi_pass  unix:///tmp/web2py.socket;
 include uwsgi_params;
 uwsgi_param UWSGI_SCHEME $scheme;
 uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;

 ###remove the comments to turn on if you want gzip 
 compression of your pages
 include /etc/nginx/conf.d/web2py/gzip.conf;
 ### end gzip section

 ### remove the comments if you use uploads (max 10 MB)
 #client_max_body_size 10m;
 ###
 }
 }*

 Thanks in advance!

 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 web2py+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.




 -- 

 Linux User #387870
 .
  _/_õ|__|
 ..º[ .-.___.-._| . . . .
 .__( o)__( o).:___ 




 -- 

 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: How to serve multiple domains and multiple applications on nginx using pattern-based route

2013-10-07 Thread Tito Garrido
This route didn't work for me...
routes_in = ((
(('.*http://demo.ivinh.com.* /*', '/demo')),
 (('.*http://demo1.ivinh.com.* /*', '/demo1'))
))

Not sure it is because I am using uwsgi... it keeps going to the default
website...




On Sat, Oct 5, 2013 at 4:30 PM, Tito Garrido titogarr...@gmail.com wrote:

 Thanks!!! I will try!


 On Fri, Oct 4, 2013 at 11:32 PM, IVINH toa...@gmail.com wrote:


 Nginx config:


 server {
  listen 80;
 server_name demo.ivinh.com www.demo.ivinh.com;
  include deny_admin.txt;
 access_log logs/demo.ivinh.com.access.log;
  error_log logs/demo.ivinh.com.error.log;
 location / {
 proxy_pass http://127.0.0.1:86;
  proxy_set_header Host demo.ivinh.com;
 include proxy.conf;
  }}
  server {
 listen 80;
  server_name demo1.ivinh.com www.demo1.ivinh.com;
  include deny_admin.txt;
 access_log logs/demo1.ivinh.com.access.log;
  error_log logs/demo1.ivinh.com.error.log;
 location / {
 proxy_pass http://127.0.0.1:86;
  proxy_set_header Host demo1.ivinh.com;
 include proxy.conf;
  }}


 Web2py routes.py run at 127.0.0.1 port 86:


 routes_in = ((
 (('.*http://demo.ivinh.com.* /*', '/demo')),
  (('.*http://demo1.ivinh.com.* /*', '/demo1'))
 ))





 Vào 06:43:07 UTC+7 Thứ bảy, ngày 05 tháng mười năm 2013, Tito Garrido đã
 viết:

 Hi Folks,

 I am using the default setup from the book for nginx:

 scripts/setup-web2py-nginx-**uwsgi-ubuntu.sh

 And my routes are using *pattern-based* system.

 The question is, how can I route www.domain1.com to app1 and
 www.domain2.com to app2?

 nginx config in sites-enabled:

 *server {
 listen  80;
 server_name $hostname;
 ###to enable correct use of response.static_version
 location ~* ^/(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ {
 alias /home/www-data/web2py/applications/$1/static/$2;
 expires max;
 }
 ###

 ###if you use something like myapp = dict(languages=[en, it,
 jp], default_language=en) in your routes.py
 #location ~* ^/(\w+)/(en|it|jp)/static/(.*)$ {
 #alias /home/www-data/web2py/applications/$1/;
 #try_files static/$2/$3 static/$3 =404;
 #}
 ###
 location ~* ^/(\w+)/static/ {
 root /home/www-data/web2py/applications/;
 #remove next comment on production
 expires max;
 ### if you want to use pre-gzipped static files (recommended)
 ### check scripts/zip_static_files.py and remove the comments
 include /etc/nginx/conf.d/web2py/gzip_static.conf;
 ###
 }
 location / {
 #uwsgi_pass  127.0.0.1:9001;
 uwsgi_pass  unix:///tmp/web2py.socket;
 include uwsgi_params;
 uwsgi_param UWSGI_SCHEME $scheme;
 uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;

 ###remove the comments to turn on if you want gzip
 compression of your pages
 include /etc/nginx/conf.d/web2py/gzip.conf;
 ### end gzip section

 ### remove the comments if you use uploads (max 10 MB)
 #client_max_body_size 10m;
 ###
 }
 }*

 Thanks in advance!

 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 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




 --

 Linux User #387870
 .
  _/_õ|__|
 ..º[ .-.___.-._| . . . .
 .__( o)__( o).:___




-- 

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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: How to serve multiple domains and multiple applications on nginx using pattern-based route

2013-10-05 Thread Tito Garrido
Thanks!!! I will try!


On Fri, Oct 4, 2013 at 11:32 PM, IVINH toa...@gmail.com wrote:


 Nginx config:


 server {
  listen 80;
 server_name demo.ivinh.com www.demo.ivinh.com;
  include deny_admin.txt;
 access_log logs/demo.ivinh.com.access.log;
  error_log logs/demo.ivinh.com.error.log;
 location / {
 proxy_pass http://127.0.0.1:86;
  proxy_set_header Host demo.ivinh.com;
 include proxy.conf;
  }}
  server {
 listen 80;
  server_name demo1.ivinh.com www.demo1.ivinh.com;
  include deny_admin.txt;
 access_log logs/demo1.ivinh.com.access.log;
  error_log logs/demo1.ivinh.com.error.log;
 location / {
 proxy_pass http://127.0.0.1:86;
  proxy_set_header Host demo1.ivinh.com;
 include proxy.conf;
  }}


 Web2py routes.py run at 127.0.0.1 port 86:


 routes_in = ((
 (('.*http://demo.ivinh.com.* /*', '/demo')),
  (('.*http://demo1.ivinh.com.* /*', '/demo1'))
 ))





 Vào 06:43:07 UTC+7 Thứ bảy, ngày 05 tháng mười năm 2013, Tito Garrido đã
 viết:

 Hi Folks,

 I am using the default setup from the book for nginx:

 scripts/setup-web2py-nginx-**uwsgi-ubuntu.sh

 And my routes are using *pattern-based* system.

 The question is, how can I route www.domain1.com to app1 and
 www.domain2.com to app2?

 nginx config in sites-enabled:

 *server {
 listen  80;
 server_name $hostname;
 ###to enable correct use of response.static_version
 location ~* ^/(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ {
 alias /home/www-data/web2py/applications/$1/static/$2;
 expires max;
 }
 ###

 ###if you use something like myapp = dict(languages=[en, it, jp],
 default_language=en) in your routes.py
 #location ~* ^/(\w+)/(en|it|jp)/static/(.*)$ {
 #alias /home/www-data/web2py/applications/$1/;
 #try_files static/$2/$3 static/$3 =404;
 #}
 ###
 location ~* ^/(\w+)/static/ {
 root /home/www-data/web2py/applications/;
 #remove next comment on production
 expires max;
 ### if you want to use pre-gzipped static files (recommended)
 ### check scripts/zip_static_files.py and remove the comments
 include /etc/nginx/conf.d/web2py/gzip_static.conf;
 ###
 }
 location / {
 #uwsgi_pass  127.0.0.1:9001;
 uwsgi_pass  unix:///tmp/web2py.socket;
 include uwsgi_params;
 uwsgi_param UWSGI_SCHEME $scheme;
 uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;

 ###remove the comments to turn on if you want gzip
 compression of your pages
 include /etc/nginx/conf.d/web2py/gzip.conf;
 ### end gzip section

 ### remove the comments if you use uploads (max 10 MB)
 #client_max_body_size 10m;
 ###
 }
 }*

 Thanks in advance!

 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 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 

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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: How to serve multiple domains and multiple applications on nginx using pattern-based route

2013-10-04 Thread IVINH

Nginx config:


server {
listen 80; 
server_name demo.ivinh.com www.demo.ivinh.com;
include deny_admin.txt;
access_log logs/demo.ivinh.com.access.log;
error_log logs/demo.ivinh.com.error.log;
location / { 
proxy_pass http://127.0.0.1:86;
proxy_set_header Host demo.ivinh.com;
include proxy.conf;
}}
 server {
listen 80; 
server_name demo1.ivinh.com www.demo1.ivinh.com;
include deny_admin.txt;
access_log logs/demo1.ivinh.com.access.log;
error_log logs/demo1.ivinh.com.error.log;
location / { 
proxy_pass http://127.0.0.1:86;
proxy_set_header Host demo1.ivinh.com;
include proxy.conf;
}}


Web2py routes.py run at 127.0.0.1 port 86:


routes_in = ((
(('.*http://demo.ivinh.com.* /*', '/demo')),
(('.*http://demo1.ivinh.com.* /*', '/demo1'))
))





Vào 06:43:07 UTC+7 Thứ bảy, ngày 05 tháng mười năm 2013, Tito Garrido đã 
viết:

 Hi Folks,

 I am using the default setup from the book for nginx: 

 scripts/setup-web2py-nginx-uwsgi-ubuntu.sh

 And my routes are using *pattern-based* system.

 The question is, how can I route www.domain1.com to app1 and 
 www.domain2.com to app2?

 nginx config in sites-enabled:

 *server {
 listen  80;
 server_name $hostname;
 ###to enable correct use of response.static_version
 location ~* ^/(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ {
 alias /home/www-data/web2py/applications/$1/static/$2;
 expires max;
 }
 ###

 ###if you use something like myapp = dict(languages=[en, it, jp], 
 default_language=en) in your routes.py
 #location ~* ^/(\w+)/(en|it|jp)/static/(.*)$ {
 #alias /home/www-data/web2py/applications/$1/;
 #try_files static/$2/$3 static/$3 =404;
 #}
 ###
 location ~* ^/(\w+)/static/ {
 root /home/www-data/web2py/applications/;
 #remove next comment on production
 expires max;
 ### if you want to use pre-gzipped static files (recommended)
 ### check scripts/zip_static_files.py and remove the comments
 include /etc/nginx/conf.d/web2py/gzip_static.conf;
 ###
 }
 location / {
 #uwsgi_pass  127.0.0.1:9001;
 uwsgi_pass  unix:///tmp/web2py.socket;
 include uwsgi_params;
 uwsgi_param UWSGI_SCHEME $scheme;
 uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;

 ###remove the comments to turn on if you want gzip compression 
 of your pages
 include /etc/nginx/conf.d/web2py/gzip.conf;
 ### end gzip section

 ### remove the comments if you use uploads (max 10 MB)
 #client_max_body_size 10m;
 ###
 }
 }*

 Thanks in advance!

 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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.