You are not logged in.

#1 2014-11-12 01:52:34

costis
Member
Registered: 2014-10-02
Posts: 14

[SOLVED] FastCGI in Lighttpd

I installed lighttdp and fcgi following the wiki without editing any configuration file. However my cgi app does not run when I go to http://localhost/app.fcgi  Instead it downloads the file. What should I do?

Last edited by costis (2014-11-12 03:53:13)

Offline

#2 2014-11-12 01:57:48

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: [SOLVED] FastCGI in Lighttpd

Did the lighttdp testpage work?  What do you mean you didn't edit any configuration files?  The wiki directs you to configuration files that you are expected to edit: if you didn't edit them, I wouldn't expect it to work.

Please describe what you have actually done.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2014-11-12 02:26:35

costis
Member
Registered: 2014-10-02
Posts: 14

Re: [SOLVED] FastCGI in Lighttpd

Apologies for my incomplete post.

I receive these:

$ cat /var/log/lighttpd/error.log 
2014-11-12 02:10:07: (log.c.164) server started 
2014-11-12 02:10:07: (mod_fastcgi.c.1112) the fastcgi-backend /srv/http/index.py failed to start: 
2014-11-12 02:10:07: (mod_fastcgi.c.1116) child exited with status 2 /srv/http/index.py 
2014-11-12 02:10:07: (mod_fastcgi.c.1119) If you're trying to run your app as a FastCGI backend, make sure you're using the FastCGI-enabled version.
If this is PHP on Gentoo, add 'fastcgi' to the USE flags. 
2014-11-12 02:10:07: (mod_fastcgi.c.1406) [ERROR]: spawning fcgi failed. 
2014-11-12 02:10:07: (server.c.1022) Configuration of plugins failed. Going down. 

I followed again the instruction doing exactly these:

su
pacman -S lighttpd fcgi
mkdir  /etc/lighttpd/conf.d
cp /usr/share/doc/lighttpd/config/conf.d/fastcgi.conf /etc/lighttpd/conf.d
systemctl start lighttpd

and following this post I appended to /etc/lighttpd/conf.d/fastcgi.conf these lines:

fastcgi.server = ( "/" =>
    ((
   "socket" => "/tmp/fastcgi.socket",
   "bin-path" => "/srv/http/index.py",
   "max-procs" => 1,
   "bin-environment" => (
     "REAL_SCRIPT_NAME" => ""
   ),
   "check-local" => "disable"
    ))
)

The test page works, the error.log does not show any error messages, but not my .fcgi script does not run Instead when I go to http://localhost/script.fcgi it downloads it

Last edited by costis (2014-11-12 02:32:54)

Offline

#4 2014-11-12 02:54:33

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,442
Website

Re: [SOLVED] FastCGI in Lighttpd

Thanks, that's clearer.  I've never used this myself in arch, but it looks like you skipped this section of the wiki:
https://wiki.archlinux.org/index.php/Lighttpd#CGI

You need to first set up (regular) cgi before fcgi.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2014-11-12 03:48:20

costis
Member
Registered: 2014-10-02
Posts: 14

Re: [SOLVED] FastCGI in Lighttpd

Thanks for the reply, this is good to know.  Now it seems to work. I had to rename my file from http://localhost/script.fcgi to  http://localhost/script.cgi and it seems to work somehow. Thanks!

# cat /etc/lighttpd/lighttpd.conf
# This is a minimal example config
# See /usr/share/doc/lighttpd
# and http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ConfigurationOptions

server.port             = 80
server.username         = "http"
server.groupname        = "http"
server.document-root    = "/srv/http"
server.errorlog         = "/var/log/lighttpd/error.log"
dir-listing.activate    = "enable"
index-file.names        = ( "index.html" )
mimetype.assign         = (
                                ".html" => "text/html",
                                ".txt" => "text/plain",
                                ".css" => "text/css",
                                ".js" => "application/x-javascript",
                                ".jpg" => "image/jpeg",
                                ".jpeg" => "image/jpeg",
                                ".gif" => "image/gif",
                                ".png" => "image/png",
                                "" => "application/octet-stream"
                        )
include "conf.d/cgi.conf"
#include "conf.d/fastcgi.conf"


# cat /etc/lighttpd/conf.d/cgi.conf 
server.modules += ( "mod_cgi" )

cgi.assign                 = ( ".pl"  => "/usr/bin/perl",
                               ".cgi" => "/usr/bin/perl",
                               ".rb"  => "/usr/bin/ruby",
                               ".erb" => "/usr/bin/eruby",
                               ".py"  => "/usr/bin/python",
                               ".php" => "/usr/bin/php-cgi" )

index-file.names           += ( "index.pl",   "default.pl",
                               "index.rb",   "default.rb",
                               "index.erb",  "default.erb",
                               "index.py",   "default.py",
                               "index.php",  "default.php" )

Last edited by costis (2014-11-12 03:52:20)

Offline

#6 2014-11-12 20:44:37

Ichimonji10
Member
Registered: 2010-11-07
Posts: 32
Website

Re: [SOLVED] FastCGI in Lighttpd

Trilby wrote:

Thanks, that's clearer.  I've never used this myself in arch, but it looks like you skipped this section of the wiki:
https://wiki.archlinux.org/index.php/Lighttpd#CGI

You need to first set up (regular) cgi before fcgi.

Hmm. That section of the wiki may be incorrect. I've set up FCGI in the past without touching CGI or installing any additional packages. You can see approximately what my FCGI configuration has looked like here.

Offline

Board footer

Powered by FluxBB