ubuntu下安装gitlist

1.安装nginx

        gitlist采用web页面的方式查看版本库,它是一个php的项目,这里选择nginx+php+php-fpm作为它的运行环境。

        之所以采用编译安装是因为系统自带的git,php版本太低,在gitlist运行时会报错,git的版本必须高于1.7.1,php版本高于 5.3.2!

wget http://nginx.org/download/nginx-1.2.4.tar.gz
tar nginx-1.2.4.tar.gz
cd nginx-1.2.4
./configure --prefix=/usr/local/nginx
make && make install

2.安装php

下载PHP:http://www.php.net/get/php-5.4.7.tar.bz2/from/cn2.php.net/mirror

tar xzvf php-5.4.7.tar.bz2
cd php-5.4.7
./configure --prefix=/usr/local/php --enable-fpm
make && make install

    这里只选择了最简单的使gitlist运行起来的php编译方式:启用php-fpm管理fastcgi,zip,bz2压缩的支持。

3.安装git

下载git:https://github.com/git/git/tarball/master

tar xzvf git-git-v1.8.0-rc0-18-gf84667d.tar.gz
cd git-git-v1.8.0-rc0-18-gf84667d
autoconf && ./configure --prefix=/usr
make && make install

4.布署gitlist

nginx默认的web发布目录/var/www

mkdir /var/www/gitlist
wget https://s3.amazonaws.com/gitlist/gitlist-0.3.tar.gz -P /var/www/gitlist
cd  /var/www/gitlist
tar xzvf gitlist-0.3.tar.gz
mkdir cache
chmod 777 cache
vim /var/www/gitlist/config.ini

    修改repositories=仓库父目录

5.nginx配置

vim /etc/nginx/sites-available/gitlist 

    复制粘贴上下两排*之间的内容

    并更改2,3,4行里的YouDomain成你的域名(随便填),只要在/etc/hosts里绑定就可以正常访问

*********************************************************

server {
    listen 80; 
    server_name YouDomain;
    access_log /var/log/nginx/YouDomain.access_log main;
    error_log /var/log/nginx/YouDomain.error_log error;
    root /var/www/gitlist;
    index index.php;


   auth_basic "Restricted";
   auth_basic_user_file rhtpasswd;


    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }   


    location ~*\.php$ {
       fastcgi_pass 127.0.0.1:9000;
       include fastcgi_params;
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
       fastcgi_index index.php;
    }   

    location / { 
        try_files $uri @gitlist;
    }   


    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
    add_header Vary "Accept-Encoding";
        expires max;
        try_files $uri @gitlist;
        tcp_nodelay off;
        tcp_nopush on; 
    }   

*********************************************************

vim /etc/hosts

    添加

127.0.0.1 YouDomain

    添加访问认证

    帐号:admin

    密码:admin123

htpasswd -cb /etc/nginx/rhtpasswd admin admin123

    上面的命令新建了密码文件/etc/nginx/rhtpasswd 并添加用户amdin

php-fpm
nginx

    启动php-fpm(fastcgi),nginx
    在浏览器里输入http://YouDomain访问你的gitlist

6.碰到的问题

1.访问http://YouDomain出现 No input file specified.
    修改location ~*\.php$结点里的fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
2.测试php页面<php? phpinfo(); php>没有显示php配置而直接显示内容<php? phpinfo(); php>说明localtion ~*\.php$没配置正确。
3.页面提示Unknown option: -c
    git版本太低要1.7.2及以上

4.终端运行命令sudo apt-get update提示MMap 没有空间了。请增大 APT::Cache-Limit 的大小

    编辑 sudo gedit /etc/apt/apt.conf
    修改APT::Cache-Limit 99999999; 

5.ubuntu update提示缺少公钥

sudo gpg --keyserver subkeys.pgp.net --recv 公钥后8位          
sudo gpg --export --armor 3E5C1192 | sudo apt-key add -





















公钥后8位如:3E5C1192 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值