安装Lighttpd和Gitweb及插件

本文详细介绍了如何在Linux系统中使用`sudoaptinstall`命令安装LighttpdWeb服务器,并配置GitWeb以支持CGI应用和Perl脚本,包括mod_cgi和mod_rewrite模块的设置以及静态文件管理和压缩。
摘要由CSDN通过智能技术生成

安装命令

sudo apt install lighttpd gitweb libcgi-application-perl

libcgi-application-perl是必须的,否则浏览器打开后是空白页面,而且没有错误信息。

修改配置文件

Lighttpd配置文件

路径:/etc/lighttpd/lighttpd.conf

server.modules = (
        "mod_access",
        "mod_alias",
        "mod_compress",
        "mod_redirect",
#       "mod_rewrite",
)

server.document-root        = "/usr/share/gitweb"
server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
server.errorlog             = "/var/log/lighttpd/error.log"
server.pid-file             = "/var/run/lighttpd.pid"
server.username             = "www-data"
server.groupname            = "www-data"
server.port                 = 80


index-file.names            = ( "index.php", "index.html", "index.lighttpd.html", "index.cgi" )
url.access-deny             = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

# gitweb
server.modules += ( "mod_cgi" )
cgi.assign =  ( ".cgi" => "/usr/bin/perl")
server.modules += ( "mod_rewrite" )
url.rewrite = (
        "^/static/(.*)$" => "/static/$1",
        "^(.*)$"    => "/gitweb.cgi$1"
)

compress.cache-dir          = "/var/cache/lighttpd/compress/"
compress.filetype           = ( "application/javascript", "text/css", "text/html", "text/plain" )

# default listening port for IPv6 falls back to the IPv4 port
## Use ipv6 if available
#include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"

Gitweb配置文件

路径:/etc/gitweb.conf

# path to git projects (<project>.git)
$projectroot = "/codes/git";

# directory to use for temp files
$git_temp = "/tmp";

# target of the home link on top of all pages
#$home_link = $my_uri || "/";

# html text to include at home page
#$home_text = "indextext.html";

# file with project list; by default, simply scan the projectroot dir.
#$projects_list = $projectroot;

# stylesheet to use
#@stylesheets = ("static/gitweb.css");

# javascript code for gitweb
#$javascript = "static/gitweb.js";

# logo to use
#$logo = "static/git-logo.png";

# the 'favicon'
#$favicon = "static/git-favicon.png";

# git-diff-tree(1) options to use for generated patches
#@diff_opts = ("-M");
@diff_opts = ();

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值