安装Nginx 和 Gitweb
 
simba@simba-laptop:~$ sudo apt-get install nginx gitweb
 
修改Gitweb配置文件
simba@simba-laptop:~/git-repo$ vim /etc/gitweb.conf 
修改或添加以下:
[plain] 
 #Git库所处路径  
$projectroot = "/home/simba/git-repo";  
  
#启用追溯  
$feature {'blame'}{'default'} = [1];  
$feature {'blame'}{'override'} = 1;  
  
#启用快照(snapshot)下载  
$feature {'snapshot'}{'default'} = ['zip', 'tgz'];  
$feature {'snapshot'}{'override'} = 1;  
 
帮助Nginx执行CGI
 
将Gitweb安装目录链接到web主目录下
simba@simba-laptop:~$ sudo ln -s /usr/share/gitweb/ /var/www/
 
修改Nginx配置文件
...
server {
set $web_root  /var/www/;
#设置变量 web_root
listen   80 default;
server_name  localhost;
 
access_log  /var/log/nginx/localhost.access.log;
 
location / {
root   $web_root;
index  index.html index.htm index.cgi;
}
 
...
 
location ~ .*\.cgi$ {
gzip off; #gzip makes scripts feel slower since they have to complete before getting gzipped
fastcgi_pass  unix:/var/run/nginx/cgiwrap-dispatch.sock;
 
 
fastcgi_index index.cgi;
fastcgi_param SCRIPT_FILENAME  $web_root$fastcgi_script_name;
fastcgi_param QUERY_STRING     $query_string;
fastcgi_param REQUEST_METHOD   $request_method;
fastcgi_param CONTENT_TYPE     $content_type;
fastcgi_param CONTENT_LENGTH   $content_length;
fastcgi_param GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param SERVER_SOFTWARE    nginx;
fastcgi_param SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param REQUEST_URI        $request_uri;
fastcgi_param DOCUMENT_URI       $document_uri;
fastcgi_param DOCUMENT_ROOT      $web_root;
fastcgi_param SERVER_PROTOCOL    $server_protocol;
fastcgi_param REMOTE_ADDR        $remote_addr;
fastcgi_param REMOTE_PORT        $remote_port;
fastcgi_param SERVER_ADDR        $server_addr;
fastcgi_param SERVER_PORT        $server_port;
fastcgi_param SERVER_NAME        $server_name;
}
 
...
}
 
重启Nginx
sudo nginx -s reload

Ubuntu Nginx搭建Gitweb服务器的更多相关文章

  1. 在Ubuntu下搭建FTP服务器的方法

    由于整个学校相当于一个大型局域网,相互之间传送数据非常快,比如要共享个电影,传点资料什么的. 所以我们可以选择搭建一个FTP服务器来共享文件. 那么问题来了,有的同学会问,我们既然在一个局域网内,直接 ...

  2. Ubuntu上搭建Git服务器

    下面我们就看看,如何在Ubuntu上搭建Git服务器.我们使用VMware虚拟机安装两台Ubantu系统,分别命名为gitServer和gitClient_01. 1.安装OpenSSH并配置SSH无 ...

  3. Ubuntu下搭建FTP服务器

    Ubuntu下搭建FTP服务器 我装的服务器系统是Ubuntu 12.04 LTS,FTP软件当然是选择大名鼎鼎的vsftpd(very secure FTP daemon), 用系统自带的FTP还好 ...

  4. Nginx 搭建图片服务器

    Nginx 搭建图片服务器 本章内容通过Nginx 和 FTP 搭建图片服务器.在学习本章内容前,请确保您的Linux 系统已经安装了Nginx和Vsftpd. Nginx 安装:http://www ...

  5. ubuntu下搭建svn服务器

    [ubuntu下搭建svn服务器] 1.创建目录 mkdir ~/svn/repository/ 2.创建仓库 svnadmin create repository 3.进入 repository/c ...

  6. 在Ubuntu中搭建KMS服务器

    介绍 基于vlmcsd搭建的KMS服务器. 根据github上的说明,这个工具是用C写的,没有任何依赖,可以直接运行.而且它横跨几乎现在所有的系统平台,如Android, FreeBSD, Solar ...

  7. Ubuntu系统搭建SVN服务器

    Ubuntu系统搭建SVN服务器 参考地址:http://git.devzeng.com/blog/aliyun-ubuntu-svn-server.html 安装软件 依次在终端中执行下面的命令安装 ...

  8. Varnish,Nginx搭建缓存服务器

    Varnish,Nginx搭建缓存服务器 一. varnish 1.安装pcre库,兼容正则表达式 # tar -zxvf pcre-8.10.tar.gz # cd pcre-8.10 # ./co ...

  9. Ubuntu环境搭建svn服务器

    记录一次使用Ubuntu环境搭建svn服务器的详细步骤 一.查看是否已经安装svn 命令:svn如果显示以下信息,说明已安装   二.卸载已安装的svn 命令:sudo apt-get remove ...

随机推荐

  1. Hybrid App简介

    Hybrid App 是混合模式应用的简称,兼具 Native App 和 Web App 两种模式应用的优势,开发成本低,拥有Web技术跨平台特性.目前大家所知道的基于中间件的移动开发框架都是采用的 ...

  2. Office2016 转换零售版为VOL版

    @echo off :ADMIN openfiles >nul >nul ||( echo Set UAC = CreateObject^("Shell.Application& ...

  3. Java NIO 操作总结

    问题: 1.Java NIO 出现大量CLOSE_WAIT或TIME_WAIT的端口无法释放 CLOSE_WAIT: 参考:http://my.oschina.net/geecoodeer/blog/ ...

  4. python添加windows域验证

    1.安装python-ldap https://pypi.python.org/pypi/python-ldap/ 在 Ubuntu/Debian 下安装 python-ldap 模块: $ sudo ...

  5. ssh-keygen -t rsa -f cloud.key ssh -i cloud.key <username>@<instance_ip>

  6. 导出Excel Gridview

    /// <summary>    /// 定义导出Excel的函数    /// </summary>    /// <param name="FileType ...

  7. 异常处理与MiniDump详解(转)

    一.   综述 总算讲到MiniDump了. Dump有多有用我都无法尽数,基本上属于定位错误修复BUG的倚天剑.(日志可以算是屠龙刀)这些都是对于那些不是必出的BUG,放在外面运行的时候出现的BUG ...

  8. True or False

    任何对象都可以被测试真值.用于if或while条件中或作为下面的布尔操作的操作数.以下值被视为假: None False 任何数值类型的零,例如,0.0.0.0j . 任何空序列,例如,". ...

  9. tryparse的用法,^0*[1-9]\d*$

    Entry entry = new Entry(); Int32 iParam; if(Int32.TryParse(entry.ajh,out iParam)) { /*如果转换成功就输出iPara ...

  10. HDU 4593 Robot (水题)

    题意:有 n 个数,其中有两个数中相同的,让你找出这个数. 析:太简单了么,只要用数组下标记一下这个数的数量即可. 代码如下: #include <iostream> #include & ...