7 messages in ru.sysoev.nginxRe: Set Variable from Content of Text...
FromSent OnAttachments
ResicowJan 8, 2009 12:04 pm 
Nick PearsonJan 8, 2009 7:20 pm 
ResicowJan 9, 2009 9:12 am 
Nick PearsonJan 9, 2009 10:00 am 
ResicowJan 9, 2009 10:16 am 
Nick PearsonJan 9, 2009 10:43 am 
Igor SysoevJan 13, 2009 8:12 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: Set Variable from Content of Text File?Actions...
From:Nick Pearson (nick@gmail.com)
Date:Jan 8, 2009 7:20:26 pm
List:ru.sysoev.nginx

John,

See Ezra's response in the thread here: http://thread.gmane.org/gmane.comp.web.nginx.english/8978/focus=8990

That explanation is just for a single downtime notice, but you can use a variation of his solution to accomplish what you want. For example:

server { ... if (-f $document_root/system/back_soon.html) { rewrite ^(.*)$ /system/back_soon.html last; break; } if (-f $document_root/system/down_for_a_while.html) { rewrite ^(.*)$ /system/down_for_a_while.html last; break; } ... }

This will show the back_soon.html page if it exists. If it doesn't exist and the down_for_a_while.html page does, then that will be displayed. Otherwise, processing will continue normally.

On Thu, Jan 8, 2009 at 2:05 PM, Resicow <resi@gmail.com> wrote:

Hello Nginx Community, and Happy New Year...

Is it possible to set the value of a variable based on the contents of a text file?

So if there is site downtime, I can place a file in a directory that nginx will see and will know to serve a downtime notice, but then can nginx read the contents of the file to determine which downtime notice to serve?

Thanks,