allins
February 27, 2008, 5:50pm
1
this works:
if ( -f /ah/sites/colon365.co.uk/public/.maintenance )
{
set $maintenance 1;
}
this doesn’t:
if ( -f $document_root/.maintenance )
{
set $maintenance 1;
}
two questions,
is there a way to make the latter work? some slight change or tweak?
why doesn’t it work? are variables not interpolated when doing file
system checks like -f?
allins
February 27, 2008, 5:53pm
2
On Wed, Feb 27, 2008 at 11:26:56AM -0500, Sean A. wrote:
{
set $maintenance 1;
}
two questions,
is there a way to make the latter work? some slight change or tweak?
why doesn’t it work? are variables not interpolated when doing file
system checks like -f?
Have you defined root ?
root /ah/sites/colon365.co.uk/public;
if (-f $document_root/.maintenance) {
set $maintenance 1;
}
allins
February 27, 2008, 5:58pm
3
On Wednesday 27 February 2008, Sean A. wrote:
{
set $maintenance 1;
}
two questions,
is there a way to make the latter work? some slight change or tweak?
why doesn’t it work? are variables not interpolated when doing file
system checks like -f?
it should work.
probably you have wrong root or root in wrong place.
plz provide full config
allins
February 27, 2008, 6:51pm
4
On Feb 27, 2008, at 11:42 AM, Roxis wrote:
if ( -f $document_root/.maintenance )
system checks like -f?
it should work.
probably you have wrong root or root in wrong place.
plz provide full config
One thing i just noticed. root is defined until after that snippet
above.
is that an issue?
Config is spread across multiple files.
Here is the best bits:
/ah/sites/colon365.co.uk/conf/nginx.conf:
server
{
listen 208.113.69.210;
server_name colon365.co.uk ;
server_name www.colon365.co.uk ;
include /ah/sites/colon365.co.uk/conf/nginx/base;
include /ah/sites/colon365.co.uk/conf/nginx/maintenance;
include /ah/sites/colon365.co.uk/conf/nginx/fake-homepage;
access_log /var/log/ah/colon365.co.uk.log combined;
include /ah/conf/nginx/www-shared;
}
–
/ah/sites/colon365.co.uk/conf/nginx/base:
set $base /ah/sites/colon365.co.uk;
–
/ah/conf/nginx/www-shared:
include /ah/conf/nginx/root;
include /ah/conf/nginx/favicon;
include /ah/conf/nginx/standard-expire;
include /ah/conf/nginx/unsub-aliases;
include /ah/conf/nginx/hackersafe;
include /ah/conf/nginx/historical;
location /
{
if ( !-e $request_filename )
{
expires -1;
proxy_pass http://mod_perl;
break;
}
}
–
/ah/conf/nginx/root:
set $root $base/public;
root $root;
allins
February 27, 2008, 8:39pm
5
On Wednesday 27 February 2008, Sean A. wrote:
One thing i just noticed. root is defined until after that snippet
above.
is that an issue?
not the “root” by itself, but all variables affecting it
allins
February 27, 2008, 8:43pm
6
On Wed, Feb 27, 2008 at 12:34:08PM -0500, Sean A. wrote:
this doesn’t:
2. why doesn’t it work? are variables not interpolated when doing
is that an issue?
listen 208.113.69.210;
expires -1;
set $root $base/public;
root $root;
The “root” directive may be set in eny place of http, server, or
locacation:
it will be properly set or inherited:
http {
server {
location / {
# here root is /path
}
}
root /path;
}
But this is not true for “set” directives: they are executed in order
of thier apperance.
include /ah/sites/colon365.co.uk/conf/nginx/base;
set $base /ah/sites/colon365.co.uk;
include /ah/sites/colon365.co.uk/conf/nginx/maintenance;
using $document_root, here it is "root ''",
because $root is still undefined
include /ah/conf/nginx/www-shared;
include /ah/conf/nginx/root;
set $root $base/public;
root $root;
You should to set “set $root $base/public;” early.
allins
February 28, 2008, 12:35pm
7
On Wed, Feb 27, 2008 at 05:12:21PM -0500, Sean A. wrote:
# here root is /path
set $base /ah/sites/colon365.co.uk;
You should to set “set $root $base/public;” early.
can you use variables in access_log setup, ie path to file?
access_log $some_thing/access.log combined;
i had a problem with that before but it was probably this exact issue.
No, nginx does not support variables in log names.
allins
February 27, 2008, 11:21pm
8
# here root is /path
set $base /ah/sites/colon365.co.uk;
You should to set “set $root $base/public;” early.
can you use variables in access_log setup, ie path to file?
access_log $some_thing/access.log combined;
i had a problem with that before but it was probably this exact issue.