You are not logged in.
Hey
Im having some problems with getting perl/cgi to work on my nginx setup. Here is what i did and what issues im having. Im hoping someone can help a bit.
Setup:
Up-to-data arch.
nginx,percona-server,php-fpm installed, running fine.
To install cgi i ran.
pacman -S fcgi fcgiwrap spawn-fcgi
Then
systemctl enable fcgiwrap.
Added cgi to nginx.
server {
listen 80;
server_name www.home.php-freedom.net;
rewrite ^ http://home.php-freedom.net$request_uri?;
}
server {
listen 80;
server_name home.php-freedom.net;
server_name_in_redirect off;
root /var/www/home_php_freedom;
location ~* ^.+\.(ico|js|gif|jpg|jpeg|png|bmp)$ {
expires 30d;
}
location / {
index index.php index.html;
}
location ~ \.php$ {
try_files $uri = 404;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/home_freedom_freedom$fastcgi_script_name;
include fastcgi_params;
}
location ~ \.cgi$ {
try_files $uri = 404;
gzip off;
include fastcgi_params;
fastcgi_pass unix:/run/fcgiwrap.sock;
fastcgi_index index.cgi;
fastcgi_param SCRIPT_FILENAME /var/www/home_php_freedom$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
Then i added (removing or adding this file does not make any difference on the error i get in the end)
/etc/systemd/system/fcgiwrap.service
[Unit]
Description=Simple CGI Server
After=nss-user-lookup.target
[Service]
ExecStart=/usr/bin/spawn-fcgi -u http -g http -s /run/fcgiwrap.sock -n -- /usr/$
ExecStartPost=/usr/bin/chmod 660 /run/fcgiwrap.sock
PrivateTmp=true
Restart=on-failure
User=http
Group=http
[Install]
Also=fcgiwrap.socket
WantedBy=multi-user.target
Rebooted.
Now i can access a test cgi file. that runs fine.
#!/usr/bin/perl
print "Content-type:text/html\n\n";
print <<EndOfHTML;
<html><head><title>Perl Environment Variables</title></head>
<body>
<h1>Perl Environment Variables</h1>
EndOfHTML
foreach $key (sort(keys %ENV)) {
print "$key = $ENV{$key}<br>\n";
}
print "</body></html>";
But when i run other more comples cgi/perl scripts I get
502 Bad Gateway
Something is missing. But im not sure what. Most likly some perl modules that are to be added maybe as args. Who knows. I hope some of you do.
Edit: It seems only apache supports mod_pearl which i may need.
Last edited by DoYouSpeakWak (2014-04-20 13:01:22)
Offline