I have a website virtual host, example.com, which is statically served out of /home/erealms/www.
However, the website runs through a series of perl scripts, which are located in various directories. So what I'm trying to accomplish is the following:
http://example.com/ -> /home/erealms/www
http://example.com/erealms -> /home/erealms/ethereal/main
http://example.com/erealms/admin -> /home/erealms/ethereal/mgmt/admin
http://example.com/erealms/config -> /home/erealms/ethereal/mgmt/config
In all directories except http://example.com/ there will be perl files, .pl, being served out through fcgiwrapper.
Here is my current configuration:
server {
add_header Cache-Control public;
access_log /var/log/nginx/access.log main buffer=32k;
error_log /var/log/nginx/error.log error;
expires max;
limit_req zone=gulag burst=200 nodelay;
listen 80;
server_name example.com;
index index.html index.htm default.html default.htm;
root /home/erealms/www;
location ~* (\.jpg|\.png|\.css)$ {
if ($http_referer !~ ^(http://rpn.ishikawa.sne.jp) ) {
return 405;
}
}
location = /favicon.ico {
return 204;
}
location /erealms/config {
root /home/erealms/ethereal/mgmt/config/;
gzip off;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:8000;
fastcgi_param SCRIPT_FILENAME /home/erealms/ethereal/mgmt/config$fastcgi_script_name;
}
location /erealms/admin {
root /home/erealms/ethereal/mgmt/admin/;
gzip off;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:8000;
fastcgi_param SCRIPT_FILENAME /home/erealms/ethereal/mgmt/admin$fastcgi_script_name;
}
location /erealms {
alias /home/erealms/ethereal/main;
gzip off;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:8000;
fastcgi_param SCRIPT_FILENAME /home/erealms/ethereal/main$fastcgi_script_name;
}
}
You'll notice that I have both root and alias directives, because I was trying to figure out what the hell was going on. Here is what's strange though. I've included below what directories are requested, and where nginx tells fcgiwrapper to access them:
http://example.com/erealms -> /home/erealms/ethereal/main/erealms
http://example.com/erealms/admin -> /home/erealms/ethereal/mgmt/admin/erealms/admin
http://example.com/erealms/config -> /home/erealms/ethereal/mgmt/config/erealms/config
Now for the time being, and just to get the damn thing working for further testing, I've just created lazy symlinks that point back to where they should be, but obviously this isn't a very elegant solution. If anyone could point me in the right direction to fixing this current setup to work, OR if you perhaps have an idea for a more elegant solution for this configuration, I would very much appreciate it.