Addition Module
Tony Holmes
atholmes at gmail.com
Tue Apr 1 16:38:45 MSD 2008
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:
<html>
<head><title>302 Found</title></head>
<body bgcolor="white">
<center><h1>302 Found</h1></center>
<hr><center>nginx/0.6.29</center>
</body>
</html>
<html>
<body>
Body of the html page
</body>
</html>
Instead of the contents of banner.html, I am getting a 302 page.
What am I doing wrong? :)
TIA!
Tony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20080401/a64a745f/attachment.html>
More information about the nginx
mailing list