On Mon, Feb 15, 2010 at 4:27 PM, Timothy Perrett
<[email protected]> wrote:
> What's with the ERB markup?

Sorry, lazy cut'n paste from a Chef template.

> BTW, im confused about why you don't handle this host selection thing in the 
> lift code and just read the host name? What is the use case here? A mobile 
> site or something similar?
>
> Also, now seeing that you want to work on a request by request basis, im not 
> sure that its going to work for you (or be safe) to dynamically use context 
> switching in the way I had suggested as its generally something you do at 
> boot time.

Sorry for the confusion. The above template is expanded at server
provisioning time. It is really as simple as envisioned in the
original mail, no dynamic switching within a single site.

So what I have is:

Two completely seperate lift apps in their own context:

domain1.com ie jetty responds to localhost:8080/domain1.com/index.html
domain2.com ie jetty responds to localhost:8080/domain2.com/index.html

This is fronted by nginx. Each domain gets an entry in enabled-sites
(Note I haven't tested this yet so this may be wrong :-) :

For domain1:
server {
 listen   80;
 server_name  www.domain1.com

 access_log  /var/log/nginx/domain1.com.access.log;
 location / {
           proxy_pass http://127.0.0.1:8080/domain1.com;
           proxy_set_header  X-Real-IP  $remote_addr;
           proxy_read_timeout 700;
           proxy_connect_timeout 120;
           proxy_set_header Host $http_host;
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 }
}

For domain2:
server {
 listen   80;
 server_name  www.domain2.com

 access_log  /var/log/nginx/domain2.com.access.log;
 location / {
           proxy_pass http://127.0.0.1:8080/domain2.com;
           proxy_set_header  X-Real-IP  $remote_addr;
           proxy_read_timeout 700;
           proxy_connect_timeout 120;
           proxy_set_header Host $http_host;
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 }
}

Appreciate your help, I'm by no means an nginx expert :-)

/Jeppe

-- 
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.

Reply via email to