Nginx and Kareha (5)

1 Name: Anonymous Techie : 2023-10-20 14:49 ID:vcQSD2Tb

Hey all,

I got the basic Kareha pl files / perl in general to execute on Nginx with the following block of code:


location ~ \.pl$ {
try_files $uri $uri/ index.html;
include fastcgi_params;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}


however attempts to render pages such as /test/kareha.pl/1697812648/ render a 404 error as there is no file/directory literally called kareha.pl/1697812648/ obviously. There is, accordingly, a file called ./res/1697812648.html that was properly created. How do I make kareha work? I'm assuming rewrites are involved, but I don't know how to do this.

2 Name: Anonymous Techie : 2023-10-20 16:45 ID:Heaven

Here's what's in my config:

location / {
try_files $uri $uri/ $uri.html =404;
autoindex off;
}
location ~ \.pl {
gzip off;
include /etc/nginx/fastcgi_params;
fastcgi_index index.pl;
fastcgi_param SCRIPT_NAME /var/www/yourwebsitehere.com/$fastcgi_script_name;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}

Not sure if hardcoding the script path is correct, but it worked for me.

3 Name: Anonymous Techie : 2023-10-20 17:01 ID:vcQSD2Tb

i feel like this is close:


location ~ \.pl(/|$) {
fastcgi_split_path_info ^(.+\.pl)(/.*)$;
try_files $uri $uri/ index.html;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
include fastcgi_params;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}


Still can't figure out how to actually view kareha.pl/123456/ though, still getting 404 errors.

4 Name: Anonymous Techie : 2023-10-20 17:48 ID:vcQSD2Tb

Solution:


server {
...
...

location ~ \.pl {
include fastcgi_params;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_split_path_info ^(.+\.pl)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
}
}

5 Name: Anonymous Techie : 2023-10-20 17:51 ID:r6QgmZaI

Very nice, now if I ever want to use Kareha with Nginx someone's done the hard work for me!

Name: Link:
Leave these fields empty (spam trap):
More options...
Verification: