Welcome! Log In Create A New Profile

Advanced

Converting an older perl script over to nginx

Posted by Pryoidain 
Converting an older perl script over to nginx
March 04, 2012 03:28AM
I'm running into a couple issues helping a friend set up nginx to run an older perl script. I'm using spawn-fcgi with the fcgi wrapper.

Before I go any farther 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 rpn.ishikawa.sne.jp;
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;
}
}

Basically, I need:
/erealms to serve out of /home/erealms/ethereal/main
/erealms/admin to serve out of /home/erealms/ethereal/mgmt/admin
/erealms/config to serve out of /home/erealms/ethereal/mgmt/config

Right now what I have in my config, when called, produces, for example /erealms/portal.pl passes /home/erealms/ethereal/main/erealms/portal.pl to the fcgiwrapper. To get around this I have implemented a very lazy symbolic link hack inside each directory. so right now I have symlinks

/home/erealms/ethereal/main/erealms -> /home/erealms/ethereal/main
/home/erealms/ethereal/mgmt/admin/erealms/admin -> /home/erealms/ethereal/mgmt/admin
/home/erealms/ethereal/mgmt/config/erealms/config -> /home/erealms/ethereal/mgmt/config

Not my finest hour, but I've been at trying to figure this out for a couple hours now, and I just wanted to get the darn thing working. If anyone has a more elegant solution, or a more elegant configuration idea, I would love to hear it.

Anyways, the main problem i'm running into now is that some of the administration scripts apparently use slashes. for example:

rpn.ishikawa.sne.jp/erealms/admin/system.pl/attribs?<some string of characters>

which when passed to the fcgiwrapper is treating system.pl as a directory. That's the biggest thing I need to fix right now. I know I've seen php sites that have a fix for this, but I'm just running in circles right now, and would appreciate any help.

Thanks for any help anyone might be able to offer.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 164
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready