diff --git a/.gitignore b/.gitignore index fc28eec..3a91107 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,7 @@ */*.sock web/nginx.conf +web/lighttpd.conf web/cgiwrap-fcgi.pl -web/*_temp/* \ No newline at end of file +web/*_temp/* +web/lighttpd-*/ \ No newline at end of file diff --git a/web/Makefile b/web/Makefile index 59f6630..5b16e92 100644 --- a/web/Makefile +++ b/web/Makefile @@ -12,12 +12,22 @@ serve: nginx.conf nginx -p $(ROOT)/ -c $(ROOT)/$< +serve-lighttpd: lighttpd.conf + lighttpd -D -f $(ROOT)/$< + + nginx.conf: $(ALL_NGINX_CONF_INPUTS) cat $< | \ sed -e 's@__ROOT__@$(ROOT)@g' \ -e 's@__HTTP_PORT__@$(HTTP_PORT)@g' > $@ +lighttpd.conf: lighttpd.conf.in + cat $< | \ + sed -e 's@__ROOT__@$(ROOT)@g' \ + -e 's@__HTTP_PORT__@$(HTTP_PORT)@g' > $@ + + serve-cgiwrap: cgiwrap-fcgi.pl perl $< diff --git a/web/html/cgi-bin/query.cgi b/web/html/cgi-bin/query.cgi index 39f46b1..949c018 100755 --- a/web/html/cgi-bin/query.cgi +++ b/web/html/cgi-bin/query.cgi @@ -3,20 +3,33 @@ use strict; use warnings; use CGI; +use CGI::Carp qw(carpout fatalsToBrowser); + + +BEGIN { + use CGI::Carp qw(carpout); + open(LOG, ">>/home/me/tmp/mycgi-log") or + die("Unable to open mycgi-log: $!\n"); + carpout(*LOG); +} sub main { my $query = CGI->new(); - my $search = $query->param('q'); + print $query->header(-content_type => 'text/plain'); - print $query->header(); + my $search = $query->param('q'); - print "You searched for: ", $query->escapeHTML($search); + if (!$search eq undef) { + printf("You searched for: %s\n", $query->escapeHTML($search)); + } else { + printf("Invalid search? You must provide a 'q' argument.\n"); + } } main(); -1; +1; __END__ diff --git a/web/lighttpd.conf.in b/web/lighttpd.conf.in new file mode 100644 index 0000000..877d00f --- /dev/null +++ b/web/lighttpd.conf.in @@ -0,0 +1,119 @@ +## modules to load +server.modules = ( + "mod_alias", + "mod_compress", + "mod_cgi", +# "mod_rewrite", +# "mod_redirect", +# "mod_usertrack", +# "mod_expire", +# "mod_flv_streaming", +# "mod_evasive" +) + +## a static document-root, for virtual-hosting take look at the +## server.virtual-* options +server.document-root = "__ROOT__/html" + +## where to upload files to, purged daily. +server.upload-dirs = ("__ROOT__/lighttpd-uploads") + +## where to send error-messages to +server.errorlog = "__ROOT__/lighttpd-error.log" + +## files to check for if .../ is requested +index-file.names = ( + "index.php", + "index.cgi", + "index.py", + "index.pl", + "index.html", + "index.htm", + "default.htm", + "index.lighttpd.html", +) + +## Use the "Content-Type" extended attribute to obtain mime type if possible +# mimetype.use-xattr = "enable" + +## +# which extensions should not be handle via static-file transfer +# +# .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi +static-file.exclude-extensions = (".php", ".pl", ".fcgi") + + +cgi.assign = ( + ".pl" => "/usr/bin/perl", + ".php" => "/usr/bin/php-cgi", + ".py" => "/usr/bin/python", +) + + +$HTTP["url"] =~ "^/cgi-bin/" { + cgi.assign += ("" => "") +} + + + + + +######### Options that are good to be but not neccesary to be changed ####### + +## Use ipv6 only if available. (disabled for while, check #560837) +#include_shell "/usr/share/lighttpd/use-ipv6.pl" + +## bind to port (default: 80) +server.port = __HTTP_PORT__ + +## bind to localhost only (default: all interfaces) +server.bind = "localhost" + +## error-handler for status 404 +#server.error-handler-404 = "/error-handler.html" +#server.error-handler-404 = "/error-handler.php" + +## to help the rc.scripts +server.pid-file = "__ROOT__/lighttpd.pid" + +## +## Format: .html +## -> ..../status-404.html for 'File not found' +#server.errorfile-prefix = "/var/www/" + +## virtual directory listings +dir-listing.encoding = "utf-8" +server.dir-listing = "enable" + +### only root can use these options +# +# chroot() to directory (default: no chroot() ) +#server.chroot = "/" + +## change uid to (default: don't change) +# server.username = "www-data" + +## change gid to (default: don't change) +# server.groupname = "www-data" + +#### compress module +compress.cache-dir = "__ROOT__/lighttpd-compress/" +compress.filetype = ("text/plain", "text/html", "application/x-javascript", "text/css") + +#### url handling modules (rewrite, redirect, access) +# url.rewrite = ( "^/$" => "/server-status" ) +# url.redirect = ( "^/wishlist/(.+)" => "http://www.123.org/$1" ) + +#### expire module +# expire.url = ( "/buggy/" => "access 2 hours", "/asdhas/" => "access plus 1 seconds 2 minutes") + +#### external configuration files +## mimetype mapping +include_shell "/usr/share/lighttpd/create-mime.assign.pl" + +## load enabled configuration files, +## read /etc/lighttpd/conf-available/README first +# include_shell "/usr/share/lighttpd/include-conf-enabled.pl" + + +# vim:filetype=lighttpd