centos6 配置 nginx + fcgiwrap + git

安装源

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh epel-release*rpm
yum install fcgi-devel spawn-fcgi -y

编译安装fcgiwrap

git clone git://github.com/gnosek/fcgiwrap.git
cd fcgiwrap
autoreconf -i
./configure
make
make install

配置fcgiwrap开机脚本

vim /etc/init.d/fcgiwrap
#! /bin/sh
# chkconfig: 2345 55 25
DESC="fcgiwrap daemon"
DEAMON=/usr/bin/spawn-fcgi
PIDFILE=/var/run/spawn-fcgi.pid
FCGI_SOCKET=/var/run/fcgiwrap.socket
FCGI_PROGRAM=/usr/local/sbin/fcgiwrap
FCGI_USER=www
FCGI_GROUP=www
FCGI_EXTRA_OPTIONS="-M 0770"
OPTIONS="-u $FCGI_USER -g $FCGI_GROUP -s $FCGI_SOCKET -S $FCGI_EXTRA_OPTIONS -F 1 -P $PIDFILE -- $FCGI_PROGRAM"
do_start() {
 $DEAMON $OPTIONS || echo -n "$DESC already running"
}
do_stop() {
 kill -INT `cat $PIDFILE` || echo -n "$DESC not running"
}
case "$1" in
 start)
  echo -n "Starting $DESC: $NAME"
  do_start
  echo "."
  ;;
 stop)
  echo -n "Stopping $DESC: $NAME"
  do_stop
  echo "."
  ;;
 restart)
  echo -n "Restarting $DESC: $NAME"
  do_stop
  do_start
  echo "."
  ;;
 *)
  echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2
  exit 3
  ;;
esac
exit 0
chmod +x fcgiwrap
chkconfig fcgiwrap on

添加git的fastcgi配置

vim /path/to/nginx/conf/fastcgi_params_git
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  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;
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;
fastcgi_param  REMOTE_USER        $remote_user;
# required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;

添加git server的nginx配置

server {
 listen   80;
 server_name  mydevserver;
 access_log /var/log/nginx/dev.access.log;
 error_log /var/log/nginx/dev.error.log;
 location / {
  root  /var/repos;
 }
 location ~ /git(/.*) {
  gzip off;
  root /usr/lib/git-core;
  fastcgi_pass  unix:/var/run/fcgiwrap.socket;
  include fastcgi_params_git;
  fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
  fastcgi_param DOCUMENT_ROOT /usr/lib/git-core/;
  fastcgi_param SCRIPT_NAME git-http-backend;
  fastcgi_param GIT_HTTP_EXPORT_ALL "";
  fastcgi_param GIT_PROJECT_ROOT /var/repos;
  fastcgi_param PATH_INFO $1;
  #fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
 }
}

注意git-http-backend的路径对不对

时间: 2024-08-01 21:33:56

centos6 配置 nginx + fcgiwrap + git的相关文章

CentOs6.5 + Nginx 1.6.0 + Node.js0.9.0 + Mongodb配置

添加非root用户 under root permision adduser wedate passwd wedate-> input the new password chmod u+w /etc/sudoers vim /etc/sudoers 添加 wedate     All=(ALL)      ALL 在root之后(首先搜索到root) :wq chmod u-w /etc/sudoers  安装必要的包依赖 更新系统所需的包 yum update  下载nginx(目前稳定版)

nginx1.8.0配置(搭配Centos6.5+Nginx+php5.6的续章)。

由于在<搭配Centos6.5+Nginx+php5.6>文章中没提到nginx的一些常用配置,写个续章 nginx的支持php配置来源自iteye的文章,http://ears.iteye.com/blog/1896542 在此感谢 1.使nginx支持php 1).在nginx.conf中的server下添加如下内容,SCRIPT_FILENAME后是你的nginx目录 2). 然后重启php-fpm和nginx(支持原理是让文件结尾为php的请求,发送到9000端口,而9000端口是ph

CentOS6.5 Nginx优化编译配置

说到Nginx,它真的算是我在运维工作中的好朋友,它优异的性能和极高的工作效率实在是让人大爱,来自internet的报告称其epoll模型能够支持高达50000个并发连接数. Epoll[维基百科]: epoll是Linux下 多路复用IO接口select/poll的增强版本,它能显著提高程序在大量并发连接中只有少量活跃的情况下的系统CPU利用率,因为它会复用文件描述符 集合来传递结果而不用迫使开发者每次等待事件之前都必须重新准备要被侦听的文件描述符集合,另一点原因就是获取事件的时候,它无须遍历

Centos6.5安装及简单配置nginx

Centos6.5安装及简单配置nginx 一.准备事项 (1) 因为nginx需要访问80端口所以请先关闭或者开放防火墙端口,和selinux. 参考命令 关闭防火墙: [[email protected] ~]# iptables -I INPUT -p tcp --dport 80 -j ACCEPT [[email protected] ~]# service iptables save 关闭selinux: [[email protected] ~]# setenforce 0 [[e

centos6 配置hhvm+php+Nginx+mysql

HHVM(HipHop Virtual Machine),Facebook的开源项目之一,用于代替php环境,这里不多做介绍,本文介绍配置教程. 安装所需的epel和hhvm yum源 rpm -Uvh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm 安装hhvm所需依赖包 sudo yum install libmcrypt-devel glog-devel jemalloc-devel t

CentOS6.5 Nginx优化编译配置[续]

继续上文CentOS6.5 Nginx优化编译配置本文记录有关Nginx系统环境的一些细节设置,有关Nginx性能调整除了配置文件吻合服务器硬件之前就是关闭不必要的服务.磁盘操作.文件描述符.内核调整等. 1.关闭系统中不需要的服务 ###Centos minimal 本来就是最小安装,这里我也就不提建议了,跟着自己的环境来###[[email protected]-it ~]# chkconfig --list auditd 0:off 1:off 2:on 3:on 4:on 5:on 6:

CentOS-6.3安装配置Nginx

CentOS-6.3安装配置Nginx zhoulf 2013-02-09除夕夜 原创 安装说明 系统环境:CentOS-6.3 软件:nginx-1.2.6.tar.gz 安装方式:源码编译安装 安装位置:/usr/local/nginx 下载地址:http://nginx.org/en/download.html 安装前提 在安装nginx前,需要确保系统安装了g++.gcc.openssl-devel.pcre-devel和zlib-devel软件.安装必须软件: [[email prot

Centos6.5 + Nginx +mysql + php 安装配置文档

一.安装环境准备 yum -y install vim lrzsz 上传mysql.nginx.php安装包 (1)Nginx的下载地址: http://nginx.org/en/download.html (2)PHP安装包的下载 http://php.net/downloads.php        (3)MySQL的下载 https://www.mysql.com/downloads/             (4)安装包上传到服务器 /usr/local/src文件夹目录下: mkdir

Setup a private http/nginx based GIT server

原文:http://aaba.me/blog/2014/03/setup-a-private-http-nginx-based-git-server.html https://doomzhou.github.io/git/linux/2016/03/30/git-over-http-by-nginx.html 参考:http://beginor.github.io/2016/03/12/http-git-server-on-nginx.html ? Downgrade Lightroom 5 c