Hello!
I am having difficulty getting the Addition Module to function
correctly. I
simply want to add a chunk of html to the top of every html file served.
My
configuration is as follows:
(cutting out unneeded portions)
server {
…
set $vhost ‘—’;
if ($http_host ~ ^(.)(.)(.)(.+).domain.com) {
set $vhost $1$2$3$4;
set $vdir $1/$2/$3/$vhost;
}
if ($vhost = '---') {
return 404;
}
location / {
add_before_body /.internal/banner.html;
root /www/users/$vdir;
index index.html index.htm;
}
location /.internal/ {
internal;
root /www/html;
}
}
So I use the host as the username and do a 3 character hash (testing for
invalid username format). The homedirs are rooted at /www/users. Hence
user.domain.com is rooted at /www/users/u/s/e/user.
The file for the banner is located in /www/html/banner.html so I use the
/.internal/ location to set the root. Then end result is this:
302 Found
nginx/0.6.29 Body of the html page
Instead of the contents of banner.html, I am getting a 302 page.
What am I doing wrong?
TIA!
Tony