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_SOFTWARE nginx/$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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.