git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-instaweb: fix lighttpd configuration on cygwin
@ 2009-03-09 18:31 Ramsay Jones
  2009-03-10 17:34 ` Pascal Obry
  0 siblings, 1 reply; 2+ messages in thread
From: Ramsay Jones @ 2009-03-09 18:31 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT Mailing-list, pascal


Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---

A recent email from Pascal reminded me that I had this patch
kicking around. I haven't tested this on Linux, since I don't
have lighttpd installed there (I already have Apache), but I
don't expect any problems; famous last words!

The essence of the change is the addition of the "mod_setenv"
module, along with the PATH environment variable assignment.
(otherwise gitweb can't find a shell and, therefore, can't
execute any git programs)

Also, I had to add a default mime-type assignment of text/plain
("" => "text/plain").  If my memory serves me, the other additions
to the mime-type mapping was just cosmetic; and why not?

Hmmm, I just noticed that the first hunk, which is needed to
suppress a "lighttpd: not found" error message, could perhaps be
seen as an un-related fix. Dunno.

ATB,
Ramsay Jones


 git-instaweb.sh |   69 ++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 66 insertions(+), 3 deletions(-)

diff --git a/git-instaweb.sh b/git-instaweb.sh
index 0843372..5f4419b 100755
--- a/git-instaweb.sh
+++ b/git-instaweb.sh
@@ -49,7 +49,7 @@ resolve_full_httpd () {
 	esac
 
 	httpd_only="$(echo $httpd | cut -f1 -d' ')"
-	if case "$httpd_only" in /*) : ;; *) which $httpd_only >/dev/null;; esac
+	if case "$httpd_only" in /*) : ;; *) which $httpd_only >/dev/null 2>&1;; esac
 	then
 		full_httpd=$httpd
 	else
@@ -179,11 +179,74 @@ lighttpd_conf () {
 	cat > "$conf" <<EOF
 server.document-root = "$fqgitdir/gitweb"
 server.port = $port
-server.modules = ( "mod_cgi" )
+server.modules = ( "mod_setenv", "mod_cgi" )
 server.indexfiles = ( "gitweb.cgi" )
 server.pid-file = "$fqgitdir/pid"
+server.errorlog = "$fqgitdir/gitweb/error.log"
+
+# to enable, add "mod_access", "mod_accesslog" to server.modules
+# variable above and uncomment this
+#accesslog.filename = "$fqgitdir/gitweb/access.log"
+
+setenv.add-environment = ( "PATH" => "/usr/local/bin:/usr/bin:/bin" )
+
 cgi.assign = ( ".cgi" => "" )
-mimetype.assign = ( ".css" => "text/css" )
+
+# mimetype mapping
+mimetype.assign             = (
+  ".pdf"          =>      "application/pdf",
+  ".sig"          =>      "application/pgp-signature",
+  ".spl"          =>      "application/futuresplash",
+  ".class"        =>      "application/octet-stream",
+  ".ps"           =>      "application/postscript",
+  ".torrent"      =>      "application/x-bittorrent",
+  ".dvi"          =>      "application/x-dvi",
+  ".gz"           =>      "application/x-gzip",
+  ".pac"          =>      "application/x-ns-proxy-autoconfig",
+  ".swf"          =>      "application/x-shockwave-flash",
+  ".tar.gz"       =>      "application/x-tgz",
+  ".tgz"          =>      "application/x-tgz",
+  ".tar"          =>      "application/x-tar",
+  ".zip"          =>      "application/zip",
+  ".mp3"          =>      "audio/mpeg",
+  ".m3u"          =>      "audio/x-mpegurl",
+  ".wma"          =>      "audio/x-ms-wma",
+  ".wax"          =>      "audio/x-ms-wax",
+  ".ogg"          =>      "application/ogg",
+  ".wav"          =>      "audio/x-wav",
+  ".gif"          =>      "image/gif",
+  ".jpg"          =>      "image/jpeg",
+  ".jpeg"         =>      "image/jpeg",
+  ".png"          =>      "image/png",
+  ".xbm"          =>      "image/x-xbitmap",
+  ".xpm"          =>      "image/x-xpixmap",
+  ".xwd"          =>      "image/x-xwindowdump",
+  ".css"          =>      "text/css",
+  ".html"         =>      "text/html",
+  ".htm"          =>      "text/html",
+  ".js"           =>      "text/javascript",
+  ".asc"          =>      "text/plain",
+  ".c"            =>      "text/plain",
+  ".cpp"          =>      "text/plain",
+  ".log"          =>      "text/plain",
+  ".conf"         =>      "text/plain",
+  ".text"         =>      "text/plain",
+  ".txt"          =>      "text/plain",
+  ".dtd"          =>      "text/xml",
+  ".xml"          =>      "text/xml",
+  ".mpeg"         =>      "video/mpeg",
+  ".mpg"          =>      "video/mpeg",
+  ".mov"          =>      "video/quicktime",
+  ".qt"           =>      "video/quicktime",
+  ".avi"          =>      "video/x-msvideo",
+  ".asf"          =>      "video/x-ms-asf",
+  ".asx"          =>      "video/x-ms-asf",
+  ".wmv"          =>      "video/x-ms-wmv",
+  ".bz2"          =>      "application/x-bzip",
+  ".tbz"          =>      "application/x-bzip-compressed-tar",
+  ".tar.bz2"      =>      "application/x-bzip-compressed-tar",
+  ""              =>      "text/plain"
+ )
 EOF
 	test x"$local" = xtrue && echo 'server.bind = "127.0.0.1"' >> "$conf"
 }
-- 
1.6.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] git-instaweb: fix lighttpd configuration on cygwin
  2009-03-09 18:31 [PATCH] git-instaweb: fix lighttpd configuration on cygwin Ramsay Jones
@ 2009-03-10 17:34 ` Pascal Obry
  0 siblings, 0 replies; 2+ messages in thread
From: Pascal Obry @ 2009-03-10 17:34 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: Junio C Hamano, GIT Mailing-list

Ramsay Jones a écrit :
> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
> ---
> 
> A recent email from Pascal reminded me that I had this patch
> kicking around. I haven't tested this on Linux, since I don't
> have lighttpd installed there (I already have Apache), but I
> don't expect any problems; famous last words!
> 
> The essence of the change is the addition of the "mod_setenv"
> module, along with the PATH environment variable assignment.
> (otherwise gitweb can't find a shell and, therefore, can't
> execute any git programs)
> 
> Also, I had to add a default mime-type assignment of text/plain
> ("" => "text/plain").  If my memory serves me, the other additions
> to the mime-type mapping was just cosmetic; and why not?
> 
> Hmmm, I just noticed that the first hunk, which is needed to
> suppress a "lighttpd: not found" error message, could perhaps be
> seen as an un-related fix. Dunno.

Tested on my side using Cygwin 1.5.25 and httpd. Working fine. Thanks.

  Tested-by: Pascal Obry <pascal@obry.net>

or

  Signed-off-by: Pascal Obry <pascal@obry.net>

Not sure as I have never seen Tested-by!

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|    http://www.obry.net  -  http://v2p.fr.eu.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver keys.gnupg.net --recv-key F949BD3B

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-03-10 17:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-09 18:31 [PATCH] git-instaweb: fix lighttpd configuration on cygwin Ramsay Jones
2009-03-10 17:34 ` Pascal Obry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).