Running Shell Scripts
Added by lfmr almost 16 years ago
Hi,
I have a shell script (".sh") that i'm trying to use with lighttpd but it always asks me to download the file, instead of running in the server.
This is the conf from my server:
lighttpd -tp -f /etc/lighttpd/lighttpd.conf config { var.PID = 11126 var.CWD = "/root" server.modules = ( "mod_indexfile", "mod_alias", "mod_access", "mod_fastcgi", "mod_cgi", "mod_accesslog", "mod_dirlisting", "mod_staticfile", # 8 ) server.document-root = "/var/www/" server.errorlog = "/etc/lighttpd/log/error.log" index-file.names = ("index.php", "index.html", "index.htm", "default.htm") mimetype.assign = ( ".pdf" => "application/pdf", ".sig" => "application/pgp-signature", ".spl" => "application/futuresplash", ".class" => "application/octet-stream", ".ps" => "application/postscript", # 5 ".torrent" => "application/x-bittorrent", ".dvi" => "application/x-dvi", ".gz" => "application/x-gzip", ".pac" => "application/x-ns-proxy-autoconfig", ".swf" => "application/x-shockwave-flash", # 10 ".tar.gz" => "application/x-tgz", ".tgz" => "application/x-tgz", ".tar" => "application/x-tar", ".zip" => "application/zip", ".mp3" => "audio/mpeg", # 15 ".m3u" => "audio/x-mpegurl", ".wma" => "audio/x-ms-wma", ".wax" => "audio/x-ms-wax", ".ogg" => "application/ogg", ".wav" => "audio/x-wav", # 20 ".gif" => "image/gif", ".jar" => "application/x-java-archive", ".jpg" => "image/jpeg", ".jpeg" => "image/jpeg", ".png" => "image/png", # 25 ".xbm" => "image/x-xbitmap", ".xpm" => "image/x-xpixmap", ".xwd" => "image/x-xwindowdump", ".css" => "text/css", ".html" => "text/html", # 30 ".htm" => "text/html", ".js" => "text/javascript", ".asc" => "text/plain", ".c" => "text/plain", ".cpp" => "text/plain", # 35 ".log" => "text/plain", ".conf" => "text/plain", ".text" => "text/plain", ".txt" => "text/plain", ".dtd" => "text/xml", # 40 ".xml" => "text/xml", ".mpeg" => "video/mpeg", ".mpg" => "video/mpeg", ".mov" => "video/quicktime", ".qt" => "video/quicktime", # 45 ".avi" => "video/x-msvideo", ".asf" => "video/x-ms-asf", ".asx" => "video/x-ms-asf", ".wmv" => "video/x-ms-wmv", ".bz2" => "application/x-bzip", # 50 ".tbz" => "application/x-bzip-compressed-tar", ".tar.bz2" => "application/x-bzip-compressed-tar", # 52 ) accesslog.filename = "/etc/lighttpd/log/access.log" url.access-deny = ("~", ".inc") static-file.exclude-extensions = (".php", ".pl", ".fcgi", ".sh") debug.log-request-header = "enable" debug.log-response-header = "enable" debug.log-request-handling = "enable" debug.log-file-not-found = "enable" cgi.assign = ( ".sh" => "", ) }
Centos 4.7 with kernel version 2.6.9-78.0.22
lighttpd/1.4.23 - a light and fast webserver
Kind Regards,
LR
Replies (1)
RE: Running Shell Scripts - Added by jimcpl almost 16 years ago
Hi,
See this thread:
http://redmine.lighttpd.net/boards/2/topics/1580
That was about getting CGI working with Perl. You'll need those other lines for the alias and the $HTTP["url"], I think.
I just tried adding ".sh" to the cgi.assign in my lighttpd.conf, so I ended up with:
cgi.assign = ( ".pl" => "/opt/perl/bin/perl", ".cgi" => "/opt/perl/bin/perl", ".sh" => "/bin/sh" )
and, after bouncing lighttpd, a test .sh file (foo.sh) works.
Jim