Newbie Here : Unable to get shell script running with fast cgi and lighty
Added by hari.ar over 5 years ago
Hi, I am trying to setup a basic web server which executes a shell script, but the script is being displayed but not executed. Please help.
My config file information as follows
config { var.PID = 1074 var.CWD = "/Users/aahuyarakshakaharil" var.log_root = "/usr/local/var/log/lighttpd" var.server_root = "/usr/local/var/www" var.state_dir = "/usr/local/var/lighttpd" var.home_dir = "/usr/local/var/lighttpd" var.conf_dir = "/usr/local/etc/lighttpd" var.vhosts_dir = "/usr/local/var/www/vhosts" var.cache_dir = "/var/cache/lighttpd" var.socket_dir = "/usr/local/var/lighttpd/sockets" server.errorlog = "/usr/local/var/log/lighttpd/error.log" server.port = 9000 server.use-ipv6 = "disable" server.username = "_www" server.groupname = "_www" server.document-root = "/usr/local/var/www" server.pid-file = "/usr/local/var/lighttpd/lighttpd.pid" cgi.assign = ( ".sh" => "/bin/bash", ".lua" => "/usr/bin/lua", ".py" => "/usr/bin/python", # 3 ) accesslog.filename = "/usr/local/var/log/lighttpd/access.log" server.modules = ("mod_access", "mod_accesslog", "mod_fastcgi") fastcgi.server = ( ".php" => ( ( "bin-path" => "/usr/local/bin/php-cgi", "socket" => "/tmp/php.socket", # 2 ), ), ) server.event-handler = "select" server.network-backend = "writev" server.max-fds = 2048 server.stat-cache-engine = "simple" server.max-connections = 256 index-file.names = ("index.xhtml", "index.html", "index.htm", "default.htm", "index.php") url.access-deny = ("~", ".inc") static-file.exclude-extensions = (".php", ".pl", ".fcgi", ".scgi") mimetype.assign = ( //Removed to keep it simple ) dir-listing.activate = "disable" dir-listing.hide-dotfiles = "disable" dir-listing.exclude = ("~$") dir-listing.encoding = "UTF-8" dir-listing.hide-header-file = "disable" dir-listing.show-header = "disable" dir-listing.hide-readme-file = "disable" dir-listing.show-readme = "disable" server.follow-symlink = "enable" $HTTP["url"] =~ "\.pdf$" { # block 1 server.range-requests = "disable" } # end of $HTTP["url"] =~ "\.pdf$" }
I am trying to access http://localhost:9000/test.sh where test.sh is present in server home. I have even created a directory cgi-bin in home and yet the script doesn't gets executed.
Any help will be appreciated. Please let me know if any other info is required.
Replies (3)
RE: Newbie Here : Unable to get shell script running with fast cgi and lighty - Added by gstrauss over 5 years ago
It looks like you're trying to configure mod_cgi to run .sh scripts, but you have not added "mod_cgi" to server.modules.
Did you check the lighttpd error log, or run lighttpd -f /etc/lighttpd/lighttpd.conf -tt
and look at the warnings?
RE: Newbie Here : Unable to get shell script running with fast cgi and lighty - Added by hari.ar over 5 years ago
Thanks a lot gstrauss for your prompt help, I missed adding cgi. It works now after adding mod_cgi.
But I think it is using cgi config to run the scripts instead of fast-cgi isn't it.? Please correct me if i am wrong just trying to connect a few dots here.
RE: Newbie Here : Unable to get shell script running with fast cgi and lighty - Added by gstrauss over 5 years ago
You will probably find the answer if you connect the dots to spending a few moments reading documentation before spending time creating an account in order to post on a forum. Please see the 'wiki' tab near the top of this page and read the docs for mod_cgi and mod_fastcgi.